Reputation: 37
I have downloaded a code which involves a minmax() function, the backbone of the code is shown below:
A = [13 5;
13, 13;
23, 26];
B = [13, 6;
13. 6;
5, 26];
C = [A;B];
Datad = minmax(C');
G = 178*Datad(1,1)/174*Datad(1,2)
and when I run the code, an error message appeared:
Undefined function or method 'minmax' for input arguments of type 'double'.
so I went onto google, and this simple code should work:
x=1:10;
m=minmax(x)
m =
1 10
BUT it did not work and the same error message appeared.
Since I do not think minmax is going to work, my question here is :
Are there any other ways to replace minmax? I know there is a min and max function which could do the job. But I am not sure how would the original minmax function work for matrices, since I would need to get it right to be able to get G.
minmax function is defined as: Here
Upvotes: 1
Views: 8465
Reputation: 10560
Try which minmax
to find out where it is located. If you get error 'minmax' not found.
, then you do not have it in you search path.
which minmax
gives me /usr/local/MATLAB/R2011b/toolbox/nnet/nnet/nndatafun/minmax.m
(Linux version), so it seems to me that the function minmax
is in Neural Network Toolbox. So maybe you haven't installed Neural Network Toolbox.
Upvotes: 3
Reputation: 9864
Use this in your code and then you don't need a separate file.
minmax = @(x) [min(x(:)) max(x(:))];
Note that it does not support [Y,I] = minmax(X)
syntax mentioned in the link you provided.
Upvotes: 3
Reputation: 12693
The error message is telling you that matlab can't find the function. There are two likely culprits here.
1) The file is not named minmax.m
: matlab looks for functions by the file name. In this case, rename the file.
2) The directory in which minmax.m
is located is not on the matlab path
. In this case, either add that directory to the path, or move the file to a directory that is on the path (or into the current directory).
Upvotes: 0