Problem in runnning .m file

조회 수: 2 (최근 30일)
Kishore adibhatla
Kishore adibhatla 2012년 5월 17일
i am using 'uiimport' to import experimental data,seperated by comma(in .txt format). I wrote .m code file to plot these data like to plot(data(:,1),data(:,2)) My query is to how to add uiimport to this .m file.. when i add this to .m file it ends up giving error"data(:,1),data(:,2) does not exist. Presently i am importing file first afterwards running .m file.Can somebody tell me is it possible to include import in .m file itself

채택된 답변

Tom Lane
Tom Lane 2012년 5월 17일
I believe MATLAB is getting confused because when it first examines the file, your "data" symbol does not appear to be a variable. Try something like this:
s = uiimport
plot(s.data(:,1),s.data(:,2))
Here "s" is obviously a variable, and "data" becomes a field of that variable as a result of the uiimport.
  댓글 수: 1
Walter Roberson
Walter Roberson 2012년 5월 17일
Oooo, the curse of the poofed variable!

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2012년 5월 17일
Before the uiimport, have a
whos
call. Have another one after the uiimport. Compare the two to see what variable name(s) have been created in the workspace.

카테고리

Help CenterFile Exchange에서 LaTeX에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by