Azzera filtri
Azzera filtri

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

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Jan
Jan il 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);

Più risposte (0)

Categorie

Scopri di più su Interactive Control and Callbacks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by