Datatype after using load in GUIDE

7 ビュー (過去 30 日間)
Jan
Jan 2019 年 2 月 9 日
回答済み: Jan 2019 年 2 月 9 日
Hi,
I have created a .mat file made of [266x3] flloats and I am trying to load it using a pushbutton in GUIDE.
Following, MATLAB Answers posts, I wrote:
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName, PathName] = uigetfile('*.mat','Select mat file');
data = load(fullfile(PathName, FileName));
handles.data = data;
guidata(hObject, handles);
I put a breakpoint inside this function to check the variable 'data'. I get:
K>> data(1)
ans =
data: [266x3 double]
Do you know how am I supposed to access, for example data(1)??
I would want data(1) to return the value in data(1), not information about the variable 'data'
Precision : if I load the .mat file directly in my workspace and ask for data(1), I get:
>> data(1)
ans =
30.2280

採用された回答

Jan
Jan 2019 年 2 月 9 日
Ok, so I figured it out.
load created a structure so I have to do: data.data(1) to access what I wanted.
Thank you, me!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by