Azzera filtri
Azzera filtri

max function is missing in the @logical file on 'matlab' toolbox

1 visualizzazione (ultimi 30 giorni)
Hello all,
I am facing a strange problem and I have not seen any possible solution for it on the web except a very loose and general solution which is re-installing a toolbox.
I am using the built-in max function in my code and matlab returns an error saying: Undefined function 'max' for input arguments of type 'struct'.
As you expected, I have surfed the web and applied EVERY possible and proposed solution but unfortunately nothing worked. I checked everything guys.
So, I typed: which max and it returns this:
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@logical\max) % logical method
and I tracked this path and surprisingly I did not find the @logical file in this path!!
as a possible solution: I uninstalled and re-installed matlab again in a hope for the @logical file to be re-established but unfortunately the problem still persisting. I also updated the toolbox.
Note: My code was running WITH absolutely NO problem and it hasn't been modified at all. All files are in the directory and there is no path issues.
Summary of the problem:
1- @logical file is missing which belongs to 'matlab' toolbox (the toolbox name is matlab). 2- The toolbox of @logical is installed and its name is matlab. 3- My matlab version is R2013b.

Risposte (1)

per isakson
per isakson il 31 Ago 2014
Modificato: per isakson il 31 Ago 2014
Firstly try
which max -all
which shows that there are max for many types of data, but not for struct.
Secondly, what do you expect that max(a_struct) should return?
"Note: My code was running WITH absolutely NO problem [...]" &nbsp Are you really sure that there isn't something else that causes the problem?
Could it be that some function, which used to return e.g a double array, now returns a struct?
  2 Commenti
Tony
Tony il 31 Ago 2014
Hello Per,
which -all max
returns this:
built-in (C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\datafun\@logical\max) %logical method
built-in(C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\datafun\@char\max) %char method
built-in(C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\datafun\@double\max) % double method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@uint8\max) % uint8 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@uint16\max) % uint16 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@uint32\max) % uint32 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@uint64\max) % uint64 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@int8\max) % int8 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@int16\max) % int16 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@int32\max) % int32 method
built-in (C:\Program Files\MATLAB\R2013b\toolbox\matlab\datafun\@int64\max) % int64 method
built-in(C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\datafun\@single\max) % single method
C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\datatypes\@categorical\max.m % categorical method
C:\ProgramFiles\MATLAB\R2013b\toolbox\distcomp\parallel\@codistributed\max.m % codistributed method
C:\ProgramFiles\MATLAB\R2013b\toolbox\distcomp\gpu\@gpuArray\max.m % gpuArray method
C:\ProgramFiles\MATLAB\R2013b\toolbox\finance\ftseries\@fints\max.m % fints method
C:\ProgramFiles\MATLAB\R2013b\toolbox\mbc\mbcmodels\@localpspline\max.m % localpspline method
C:\ProgramFiles\MATLAB\R2013b\toolbox\mbc\mbcmodels\@localpoly\max.m % localpoly method
C:\ProgramFiles\MATLAB\R2013b\toolbox\matlab\timeseries\@timeseries\max.m % timeseries method
I have a very complicated code and when I run it I get this exact error:
??? Undefined function or method 'max' for input arguments of type 'struct'.
Error in ==> Ban_atm at 67
if max(wav_index)>length(cells.wavnum) | min(wav_index)<1
and it was running perfectly and smoothly.
BTW, according to my experience on seeking out solutions for this bug:
Undefined function or method 'max' for input arguments of type 'struct'.
it does not imply or indicate one solution! Though I tried every proposed solution for this error, yet non is working.
The:
wav_index
is a struct and I want to perform the operation mentioned above which is the max of that
wav_index
Thank you. Your guide over this error is much appreciated.
per isakson
per isakson il 31 Ago 2014
Modificato: per isakson il 31 Ago 2014
I bet wav_index wasn't a struct when your code run in the previous release. With Matlab you cannot be sure.
wav_index, isn't that a strange name for a struct. "Index" indicates a vector of whole numbers.
How is wav_index assigned its value?

Accedi per commentare.

Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by