Save Data Matrix GUI
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all! I have a list box that I am able to choose various elements,push a button,erase the selected elements from my first listbox and then I want to save them in a matrix so I can pass it to another listbox.Is there any way I can do that without globals?I am newbie to GUIDE so please excuse if this seems dumb. Here's a piece of code. Thank you all
function pushbutton3_Callback(hObject, eventdata, handles)%Data input
handles.fileName=uigetfile('*.xls');
if handles.fileName == 0
return
end
[handles.Values,handles.Headers]=xlsread(handles.fileName);
handles.Names=handles.Headers(1,2:end)
set(handles.nAssets,'String',handles.Names,'Value',1)
handles.Dates=handles.Headers(2:end,1)
handles.Values=handles.Values(:,3:end)
guidata(hObject,handles);
function in_Callback(hObject, eventdata, handles)
List = handles.nAssets;%nAssets is the listbox' name
indexed = get(List,'value');
Names = get(List,'String');
handles.newNames=Names(indexed)%saving the names selected
Names(indexed) = [];
set(handles.nAssets,'String',Names,'Value',1)
guidata(hObject,handles)
0 件のコメント
採用された回答
Jan
2013 年 7 月 1 日
You can use guidata to store values in the figure's ApplicationData. This is not as global as global, but local to the current figure. An equivalent method is storing data in the figure's 'UserData'.
See:
doc guidata
0 件のコメント
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Creating, Deleting, and Querying Graphics Objects についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!