load name im array

조회 수: 12 (최근 30일)
Manuel
Manuel 2017년 7월 10일
답변: Walter Roberson 2017년 7월 10일
Hello,
i have an issuse according to the load function.
load 'f(1)' % searches for a file called f(1)
what i want:
load the file named like the first entry in variable f
Thanks

채택된 답변

Walter Roberson
Walter Roberson 2017년 7월 10일
load(f{1})
However, please remember that it is bad practice to "poof" variables into the workspace. It is better to assign the output of load() to a variable and access the components as needed:
f1struct = load(f{1});
x = f1struct.x; %now access the stored values
y = f1struct.y;

추가 답변 (1개)

KSSV
KSSV 2017년 7월 10일
Hoping your f is a cell array of names of the files in the folder..you may use.
load f{1}
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 7월 10일
No, that is equivalent of load('f{1}')

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

카테고리

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