Error using eval when load many files in recursive
6 views (last 30 days)
I want to load many files, i.e.
where "6" can be vary from 1 to 20
I did try using :
eval(['load SST_mw_region' num2str(k) '.mat','sst','time','lon','lat';'])
I am not sure where I have to put ' ' and how many of them
Walter Roberson on 20 Sep 2019
Don't use eval(). Construct your filenames using sprintf() and use the function form of load instead of the command form.
Note that when you do not assign the output of load() to a variable, that each iteration each of the variables you just loaded will be overwritten completely with the variables you just loaded.