Interactively inputing a workspace table name

조회 수: 7 (최근 30일)
Walter Johnson
Walter Johnson 2018년 6월 10일
편집: Stephen23 2018년 6월 10일
I want to use the input function to read in the name of a workspace file and then use that file, e.g.
datafilename = input('input the name of the training data table','s');
Mdl = fitrsvm(datafilename,'somevariablename');
where datafilename is the name of a table in the workspace (and somevariablename is a column header in that table). But I am unsuccessful in all my attempts to do this. Can anyone give me some help on this?
  댓글 수: 1
Stephen23
Stephen23 2018년 6월 10일
편집: Stephen23 2018년 6월 10일
"But I am unsuccessful in all my attempts to do this. Can anyone give me some help on this?"
Yes. The easiest (waste less of your time, neater, simpler, faster, less buggy) solution is to avoid this situation entirely. The critical question is: how did those variables get into your workspace? Most likely you did not sit and type out the names of hundreds of variables: either they were imported e.g. using load, or perhaps created in a loop. In either case it is trivial to avoid the situation, e.g. load into an output argument:
S = load(...)
If you give us some more information on how the data get into your workspace then we can show you simple ways of accessing it.

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

답변 (1개)

Walter Roberson
Walter Roberson 2018년 6월 10일

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by