Truble with LOAD in GUI

조회 수: 2 (최근 30일)
Jiri Franc
Jiri Franc 2014년 12월 18일
댓글: Jiri Franc 2014년 12월 18일
Hi, I have problem with loading variables to worksapace using GUI. What I want to do is that when I press the button, open dialog pops up and I select *.mat file, which I created earlier. To this point everything works fine. Name of the file is assigned to a variable. After that I do not realy know what to do. I know, that I simply cannot use load(variable). But even if I tried some modification with assignin and evalin, I sitll can get those variables stored in *.mat file to workspace.
Here is the CallBack function:
function open_menubutton_callback(u,t)
file = uigetfile('*.mat')
load(file,'*.mat')
Any sugestions, what should I add or change?

채택된 답변

Orion
Orion 2014년 12월 18일
Hi,
one suggestion :
[FileName,PathName] = uigetfile('*.mat');
evalin('base',sprintf('load(''%s'')',fullfile(PathName,FileName)))
  댓글 수: 1
Jiri Franc
Jiri Franc 2014년 12월 18일
Works perfectly! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (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