Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top