error Undefined function or method 'min' for input arguments of type 'struct'
2 ビュー (過去 30 日間)
古いコメントを表示
Zulfa Muthmainnah
2016 年 2 月 19 日
コメント済み: Zulfa Muthmainnah
2016 年 2 月 20 日
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 件のコメント
採用された回答
Walter Roberson
2016 年 2 月 19 日
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!