MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by FIR
on 21 Dec 2012

I have a 386x514 quaternion array,in this please tell how to find the minimum value of that matrix

*No products are associated with this question.*

Answer by Matt J
on 21 Dec 2012

Edited by Matt J
on 21 Dec 2012

Accepted answer

BSXFUN isn't overloaded well in the quaternion toolbox that you're using. Here is a workaround

q= convert(A(i-1:i+1,j-1:j+1),'single'); [minsum, minidx] = min( sum(abs( repmat(q(:),1,9)-repmat(q(:).',9,1) ) ));

Show 6 older comments

FIR
on 22 Dec 2012

i have found 4 values using above equation

V1,V2,V3,V4

now i want to apply in code

A=imreadq('peppers.png'); T=65; for i=2:6 for j=2:6 q= convert(A(i-1:i+1,j-1:j+1),'single'); [minsum, minidx] = min( sum(abs( repmat(q(:),1,9)-repmat(q(:).',9,1) ) ));

S=min([V1 V2 V3 V4]); if S>T THE CENTRE PIXEL OF QUANTERION ARRAY IS REPLACED BY minsum

else THE CENTRE PIXEL IS not REPLACED BY minsum end end end

please help,and original image must be added with noise,please assist

Walter Roberson
on 22 Dec 2012

Or, since that would affect the computations as you slid the window, create a second array and set the pixels in it -- as I showed you in one of your previous questions.

## 3 Comments

## Walter Roberson (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57138#comment_118431

What does each element look like? Is there a reason you cannot just use min(TheMatrix(:)) ?

## FIR (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57138#comment_118439

My form is 384x512 pure quaternion array with uint8 components

if i use min i get error

Undefined function or method 'min' for input arguments of type 'quaternion'.

## Matt J (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/57138#comment_118541

FIR Commented:i downloaded [the quaternion] tool box from here

http://sourceforge.net/projects/qtfm/

FIR Commented:Sorry Matt my code [which doesn't work] is