Import data as a structure array from a text file with different titles in the middle.
Show older comments
Hi,
I have this kind of a data file (I have attached the file here), for different time values particle cordinates and other variables. I want to import this data to matlab as structure array, Ex: for differenent time values x, y, z columns. Attached file has x, y, z,...data for 2 time values. My original file has this for 2796 time values (huge file).
So far I have tried this but it didn't work. And I can't understand how to use "struct" here, 1*2796 struct with 4 fields (number of particles (50), x, y, z) . My ultimate goal is to make a movie with these particle trajectoties.
pardist = load('datafile.txt');
for t=-3.555e-11:2e-11:5.590e-8 %this is the time frame.
for k=0:2796 % how many times
k1=3+3*k+50*k; % to get the correct row number; as I have time and column name in the middle.
data(t)=pardist(:,k1:k1+49)
end
end
Could you please help me with importing this data to a structure array. Thank you very much.
1 Comment
Accepted Answer
More Answers (0)
Categories
Find more on Spreadsheets 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!