필터 지우기
필터 지우기

How to access to variables saved in Matlab folder from the GUI

조회 수: 1 (최근 30일)
Ege
Ege 2015년 1월 5일
편집: per isakson 2015년 1월 6일
I want to load my dataset or access any other variables that are saved to my matlab folder or are in my workspace currently from the matlab GUI I created. But when I call my functions on callback function of a button, I can't do it. Could you give me a simple example how to do it?
  댓글 수: 2
per isakson
per isakson 2015년 1월 5일
"any other variables that are saved to my matlab folder" &nbsp do you mean saved in a mat-file in the current folder?
See evalin
Ege
Ege 2015년 1월 5일
Yes exactly. I mean mat files

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

채택된 답변

per isakson
per isakson 2015년 1월 5일
편집: per isakson 2015년 1월 5일
Add lines similar to the following, which are copied from the doc on load
filename = 'durer.mat';
myVars = {'X','caption'};
S = load(filename,myVars{:})
to the callback function.
&nbsp
" or are in my workspace" &nbsp see evalin, Execute MATLAB expression in specified workspace and add
my_variable = evalin( 'base', 'my_variable' )
to the callback function.
  댓글 수: 8
Ege
Ege 2015년 1월 6일
Making the variables global and adding assigning solved my problem thank you very much for your help :)
per isakson
per isakson 2015년 1월 6일
편집: per isakson 2015년 1월 6일
"I can't do anything on it"
  • I assume that assignin actually assigned a variable in the base workspace
  • load assigns a value to the variable S.&nbsp dataset2 is not a variable, but a field of the struct S. Try churn = S.dataset2.churn;.
Comments

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by