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

1 visualización (últimos 30 días)
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

Respuesta aceptada

Jan
Jan el 22 de Feb. de 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);

Más respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by