Load variables from subfolders

1 回表示 (過去 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 Center および File ExchangeGet Started with MATLAB についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by