Could any body help me to put mat file in workspace from current folder in gui surface ?

1 次查看(过去 30 天)
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

采纳的回答

Jan
Jan 2014-2-22
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);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by