필터 지우기
필터 지우기

How can you program to automatically rename imported data?

조회 수: 8 (최근 30일)
Aaron Burdick
Aaron Burdick 2011년 8월 18일
I am writing a larger program to automate creation of some graphs. I have an importfile function to bring in the data as a variable (it's a matrix). I need to create another identical matrix to this imported data but renaming it "values" so that it can be used later in the overarching program for creating the graphs.
How can I change the function so that it will create a duplicate matrix to the imported file named "values"?
Thank you!!!
Aaron

답변 (2개)

Fangjun Jiang
Fangjun Jiang 2011년 8월 18일
What do you mean? rand() is a function, so
a=rand(10);
values=a;
You don't need to change the function.
See the link on the Mathworks website for generating re-usable code for uiimport(). Pay attention to the part regarding return variable.
  댓글 수: 2
Aaron Burdick
Aaron Burdick 2011년 8월 18일
Basically I say importfile(uXYPPBVCH4) and then Matlab imports the file and creates a Matrix named "uXYPPBVCH4". I need to have this imported matrix duplicated as another matrix named "values" so that I can use the variable "values" in creating a plot.
Does that make sense?
Thanks!
Fangjun Jiang
Fangjun Jiang 2011년 8월 19일
Is the importfile() function generated after using uiimport()? Below is an excerpt from the documentation. If your importfile() doesn't have a return argument, you need to re-run uiimport() with a return argument so the generated importfile() will also have a return argument. Then you can assign any variable name for it.
If you do not import into a structure array, the generated function creates variables in the base workspace. If you plan to call the generated function from within your own function, your function cannot access these variables. To allow your function to access the data, start the Import Wizard by calling uiimport with an output argument. Call the generated function with an output argument to create a structure array in the workspace of your function.

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


Sean de Wolski
Sean de Wolski 2011년 8월 18일
values = importdata('uXYPPBVCH4.mat');
  댓글 수: 5
Fangjun Jiang
Fangjun Jiang 2011년 8월 19일
http://www.mathworks.com/matlabcentral/answers/11871-importfile-from-a-gui
Fangjun Jiang
Fangjun Jiang 2011년 8월 19일
The Mathworks link is here. Search for importfile on the page.
http://www.mathworks.com/help/techdoc/import_export/br5wz4t.html

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by