error Undefined function or method 'min' for input arguments of type 'struct'
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zulfa Muthmainnah
el 19 de Feb. de 2016
Comentada: Zulfa Muthmainnah
el 20 de Feb. de 2016
I want to find min and max value of my matriks
P = load('grading/datauji.mat');
min_P = min(P,[],3);
max_P = max(P,[],3);
but it gives me error:
??? Error while evaluating uicontrol Callback
??? Undefined function or method 'min' for input arguments
of type 'struct'.
Error in ==> guikedelaizulfa>identifikasi_Callback at 1427
min_P = min(P,[],3);
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> guikedelaizulfa at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)guikedelaizulfa('identifikasi_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Can you help me? Thanks
0 comentarios
Respuesta aceptada
Walter Roberson
el 19 de Feb. de 2016
When you assign the output of load() of a .mat file to a variable, the result is a structure array that has one field for each variable that was in the file. For example if the .mat file contained the variables SampleDates and CO2_Readings then
P = load('grading/datauji.mat');
would return a struct with fields SampleDates and CO2_Readings . You would then, for example,
min(P.CO2_Readings)
using the appropriate field name corresponding to the variable you wanted.
If you do not know the names of the variables ahead of time then there are techniques to access the data. Those techniques are most straight-forward when there is only a single variable in the file; if there are multiple variables then you need to program in some idea of which of the variables with unknown names is the one you want to work with.
Más respuestas (0)
Ver también
Categorías
Más información sobre Workspace Variables and MAT Files en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!