I am trying to load a structure to a handle that I can use in a GUI. When I load the structure, I use
handles.data=load('structure.mat')
However, when I want to pull data from it, I have to use a nested structure of sorts. So if the original structure was DLG, when using the data within the GUI, I have to use handles.data.DLG.fieldname. Is there anyway to just use the DLG structure instead of all of the handles stuff? Below is a function that might be relevant to the question.
function pushbutton2_Callback(hObject, eventdata, handles)
handles.data = load(fullfile(handles.folder, handles.item));
tmp_nam = fieldnames(handles.data.DLG.metadata);
tmp_val = cellfun(@(x)(handles.data.DLG.metadata.(x)),tmp_nam,'UniformOutput',false);
handles.table = [tmp_nam tmp_val];
set(handles.uitable2,'data',handles.table);
guidata(gcbo, handles);
1 件のコメント
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/342863-how-to-load-a-structure-as-a-handle#comment_458371
このコメントへの直接リンク
https://jp.mathworks.com/matlabcentral/answers/342863-how-to-load-a-structure-as-a-handle#comment_458371
サインインしてコメントする。