フィルターのクリア

Saving data from function i GUI

1 回表示 (過去 30 日間)
Niels
Niels 2014 年 4 月 4 日
回答済み: Niels 2014 年 4 月 4 日
Hi All,
I have the following code, where I want to save the values into the workspace for further processing. A number is previoucly defined, which finds ship properties in Shipdata_module. m. I can see the values being returned in the command window from the data file, but it does not save them. How can I do that ?
% --- Executes on button press in loadship.
function loadship_Callback(hObject, eventdata, handles)
% hObject handle to loadship (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
number = handles.number
[Lpp,B,D,T,Disp,Loa,AeA0,Dmax,z] = Shipdata_module(number)

採用された回答

Jeff Johnson
Jeff Johnson 2014 年 4 月 4 日
Hi Niels,
Try the assignin function to store the output variables in the base workspace.

その他の回答 (2 件)

Niels
Niels 2014 年 4 月 4 日
Hi Jeff. It did the trick. Now I have only one problem. How can I show the saved data in an Edit box in the Gui, so the different ship information is shown depending on which ship one select in the popupmenu ?
For all others, here is the code:
assignin('base','Lpp',handles.Lpp1);
assignin('base','B',handles.B);
assignin('base','D',handles.D);
assignin('base','T',handles.T);
assignin('base','Disp',handles.Disp);
assignin('base','Loa',handles.Loa);
assignin('base','AeA0',handles.AeA0);
assignin('base','Dmax',handles.Dmax);
assignin('base','z',handles.z);

Niels
Niels 2014 年 4 月 4 日
Killing the thread. Did not assign the handles in OpeningfCn....going on weekend :)
/Niels

カテゴリ

Help Center および File ExchangeGraphics Object Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by