Access files from different directories within same loop

2 ビュー (過去 30 日間)
Daphne PARLIARI
Daphne PARLIARI 2020 年 1 月 26 日
編集済み: Mohammad Sami 2020 年 1 月 26 日
Hello everyone, I am requesting your help...
I want to access multiple files based on the filename, load two of them each time loop proceeds, and do several things, like compare mean values.
I have a list of stations (see attached) based on which I am building the loop. wrfdir corresponds to the .csv that contain simulated values for every station and obsdir has the .txt with measured data. When i run the code I get the "Error using importdata (line 139). Unable to open file. Error in Untitled (line 17). a=importdata(wrffile);"
So far I have only tried to load the wrf files...
obsdir ='C:\PhD\Projects\LIFE ASTI\C.3\C.3\Weather station data\from desktop\OutputObservations\';
wrfdir = 'C:\Projects\LIFE ASTI\C.3\C.3\Weather station data\from desktop\2019 run\Thess\';
stations = readtable('C:\PhD\Projects\LIFE ASTI\C.3\C.3\Weather station data\from desktop\Stations Coordinates.xlsx');
stations = table2cell(stations);
for i=1:size(stations,1)
wrffile=[wrfdir, stations{i,1},'.csv'];
a=importdata(wrffile);
return
end
  1 件のコメント
Mohammad Sami
Mohammad Sami 2020 年 1 月 26 日
編集済み: Mohammad Sami 2020 年 1 月 26 日
use the fullfile function to create the file paths
wrffile=fullfile(wrfdir, [stations{i,1}, '.csv']);

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAdding custom doc についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by