From: Erik Andersson on
Hello!
I have a n*m*t matrix wher a=8, b=20, c=20. In this matrix a have calculated error in different values. Now I want to find the indexvalues, i.e. the values of n, m and t where the minimumerrorvalue of the matrix is?

Thankfull for help!

/E
From: Sean on
"Erik Andersson" <annerk02(a)student.umu.se> wrote in message <hra24c$di4$1(a)fred.mathworks.com>...
> Hello!
> I have a n*m*t matrix wher a=8, b=20, c=20. In this matrix a have calculated error in different values. Now I want to find the indexvalues, i.e. the values of n, m and t where the minimumerrorvalue of the matrix is?
>
> Thankfull for help!
>
> /E


>> [my_min, idx] = min(matrix);
>>[row, col, pag] = ind2sub(size(matrix),idx);
From: Walter Roberson on
Erik Andersson wrote:
> Hello!
> I have a n*m*t matrix wher a=8, b=20, c=20. In this matrix a have
> calculated error in different values. Now I want to find the
> indexvalues, i.e. the values of n, m and t where the minimumerrorvalue
> of the matrix is?

[minval, idx] = min(TheMatrix(:));
[aidx, bidx, cidx] = ind2sub(size(TheMatrix), idx);
From: Bruno Luong on
"Erik Andersson" <annerk02(a)student.umu.se> wrote in message <hra24c$di4$1(a)fred.mathworks.com>...
> Hello!
> I have a n*m*t matrix wher a=8, b=20, c=20. In this matrix a have calculated error in different values. Now I want to find the indexvalues, i.e. the values of n, m and t where the minimumerrorvalue of the matrix is?
>

% Generate the test matrix
M=rand(8,20,20)

% engine
[minM idx] = min(M(:));
[n m t] = ind2sub(size(M),idx)

% check
minM
M(n,m,t)

% Bruno
From: someone on
"Erik Andersson" <annerk02(a)student.umu.se> wrote in message <hra24c$di4$1(a)fred.mathworks.com>...
> Hello!
> I have a n*m*t matrix wher a=8, b=20, c=20. In this matrix a have calculated error in different values. Now I want to find the indexvalues, i.e. the values of n, m and t where the minimumerrorvalue of the matrix is?
>
> Thankfull for help!
>
> /E

% Something like this (may take some tweaking):
% I'm not sure what your a, b, & c above are.
% First use the min command with the ind option:
[c,ind] = min(A(:));
% then use the ind2sub command
% convert the llinear index to array subscripts:
[n,m,t] = ind2sub(size(A),ind)