我有一個由循環創建的變量。該變量足夠大,並且形式複雜,我希望每次使用不同的名稱出現循環時都保存該變量。基於字符串的名稱變量MATLAB
PM25是我的變量。但我想將其保存爲PM25_year,其中,基於`海峽= FNAME年的變化(13:結束)」
PM25 = permute(reshape(E',[c,r/nlay,nlay]),[2,1,3]); % Reshape and permute to achieve the right shape. Each face of the 3D should be one day
str = fname(13:end); % The year
% Third dimension is organized so that the data for each site is on a face
save('PM25_str', 'PM25_Daily_US.mat', '-append')
該海峽是一年,像2008年那麼保存的將是PM25_2008變量,然後PM25_2009等,因爲它是創建。