Could any body help me to put mat file in workspace from current folder in gui surface ?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Onur PEKER
am 22 Feb. 2014
Bearbeitet: Onur PEKER
am 22 Feb. 2014
I am trying this code but it is not working.Nothing is changing in workspace when I push button which name is airflow_input
if true
function airflow_input_Callback(hObject, eventdata, handles)
airflow_input=importdata('airflow_test_data.txt');
load('norm_airflow_area'); load('norm_airflow_dev');
end
0 Kommentare
Akzeptierte Antwort
Jan
am 22 Feb. 2014
Your observation is correct. Each function has its own workspace in Matlab. The contents of the files are loaded into the callback's workspace, but they are deleted as soon as this function is left afterwards. Try this:
function airflow_input_Callback(hObject, eventdata, handles)
airflow_input = importdata('airflow_test_data.txt');
area_data = load('norm_airflow_area');
dev_data = load('norm_airflow_dev');
disp(area_data)
disp(dev_data)
end
You see, that the variables are imported, but not forwarded magically to the base workspace of the command window. If you really want to do this, use:
assignin('base', 'area_data', area_data);
1 Kommentar
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!