Save Data Matrix GUI
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuesta aceptada
Jan
el 1 de Jul. de 2013
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 comentarios
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects 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!