Processing Multiple Files at once.

16 vues (au cours des 30 derniers jours)
Sai Gudlur
Sai Gudlur le 21 Fév 2024
Commenté : Sai Gudlur le 21 Fév 2024
Hello Everyone,
I have attached two Scripts to this. One of the scripts processes (File named Single Single_FIle_GPP) spits the output I am looking for but I would want my code to do this with multiple files are selected.
Currently my output is of Two Columns and 80 Rows (max) from one file in a table format. In case of of multiple files I would want my next files output spaced by one column.
MultiFile_Input is the Incomeplete Script.
Could someone suggest an efficient indexing method Please.
Thanks
  2 commentaires
VBBV
VBBV le 21 Fév 2024
Add single and/or double whitespace to end of the existing completed table variable for single file input and process it for multiple files reading each file data sequentially in a loop
VBBV
VBBV le 21 Fév 2024
Important that table variables used for reading data must remain same for each input file

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 21 Fév 2024
[filelist,pathn] = uigetfile('*.*','Please Select a Par File in .dat or .txt', 'multiselect', 'on');
if isnumeric(filelist); error('no file selected'); end
filelist = cellstr(filelist); %take care of case where a single file was selected
filelist = fullfile(pathn, filelist);
for K = 1 : length(filelist)
filename = filelist{K};
%do the processing stuff here
%....
Complete_Table{K} = vertcat(TF_Standard_Table,TF_Performance_Table,TF_Tanker_Table,TF_Off_Road_Table);
end
At this point you have to decide how you want to put all of the tables together. In the general case, you cannot assume that TF_Standard is the same for all of the files. Maybe you want to do an inner join or something like that.
  1 commentaire
Sai Gudlur
Sai Gudlur le 21 Fév 2024
Thanks a lot Mr.Roberson. I had a typo in my script I accidently added TF_Standard to Economy table which I fixed after reading your comment.
With the current format tables within the variable complete table are stored as Cell. Will try to extract tables from the Cells.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by