Organizing array of data skipping empty values
Show older comments
Hello,
I need to organize data (now stored in .txt files) in either a single .txt file or in a struct; my problem is that this txt files, that are coming from simulations, miss a variable number of lines each. What I thought to do is to load each file inside a structure named P, and to create a struct file named M with each substructure having the maximum number of rows and columns that the files should contain, filled with zeros.
Then I wanted to write every row contained in the substructures of P in the corresponding substructures of M, leaving a row of zeros where the data files are missing a line. The .txt files all have in the first column an increasing value going from -5 to 25 with steps of 0.1, with the exception of the missing lines, as I said before. Can anyone help me on this part? How could I do?
Below you can see what I have written until now:
path='C:\Users\iberi\Desktop\Università\Magistrale\Tesi\MATLAB\Grafici_xx07\Polars\Section1\';
Re={'Re0100' 'Re0110' 'Re0120' 'Re0130' 'Re0140' 'Re0150' 'Re0160' 'Re0170' 'Re0180' 'Re0190' 'Re0200' 'Re0210' 'Re0220' 'Re0230' 'Re0240' 'Re0250' 'Re0260' 'Re0270' 'Re0280' 'Re0290' 'Re0300' 'Re0310' 'Re0320' 'Re0330' 'Re0340' 'Re0350'};
for i=1:length(Re)
M.(Re{i})=zeros(301,10);
P.(Re{i})=load([path, 'CLARK_Y_W=0.02_TEGap0.75_Blend0.6_FOIL2CAD_smooth_300_T1_' Re{i} '_M0.00_N9.0.txt']);
for j=1:301
for z=1:10
end
end
end
4 Comments
Mathieu NOE
on 7 Jul 2021
hello Marco
would you be able to share the data files ? pls make a zip if you have many
tx
Marco Gualtieri
on 7 Jul 2021
Yazan
on 7 Jul 2021
I'm not sure I understood what you are after. Do you need to read txt files in which some lines are empty?
Marco Gualtieri
on 7 Jul 2021
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!