필터 지우기
필터 지우기

Load variables from subfolders

조회 수: 3 (최근 30일)
Joel Schelander
Joel Schelander 2021년 4월 8일
편집: Jan 2021년 4월 8일
I have two variables called ARG_1 and ARG_2
The script I use is in the folder MATLAB. The variables are within subfolders: MATLAB/Ruralv/Appr.
I use this to load the variables, but since they are in subfolders it won't work.
for x= 1:2
load (['ARG_x' num2str(x) '.mat'])
end
  댓글 수: 1
Jan
Jan 2021년 4월 8일
편집: Jan 2021년 4월 8일
Please post the error message instead of the general statement "it won't work".

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

채택된 답변

Jan
Jan 2021년 4월 8일
편집: Jan 2021년 4월 8일
I guess, that the loading does not work due to the subfolders?
Where is the folder "MATLAB"? Inside your user folder and you are working on Linux or MacOS? Then:
for x = 1:2
load(fullfile('~/MATLAB/Ruralv/Appr', sprintf('ARG_%d.mat', x));
end

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by