How to read the value of a cell one-by-one?

4 views (last 30 days)
Dear All
I have a TLE(Two-line element) and I got the following code to structure the data.
fid=fopen('2B.txt');
A=textscan(fid,'%s','HeaderLines',5);
Data=reshape(A{1}(1:end-3,:),9,[])';
fclose(fid);
format long g;
l1=Data(1:2:end,:);
l2=Data(2:2:end,:);
I have the below TLE for a satellite, for example I want to access each and every value of (1,3) which is 96063A. In this 96 is year of launch, 06 is month of launch and so on. With the above code the data of each row and column is stored in individual cell. how can I access each value of the whole file.
Thanks
=====================================================================
24652 1996-063A ARABSAT-2B
Launched: 1996-11-13 (318) Start Date: 1996-06-12 (164)
Decayed: Stop Date: 2003-12-20 (354)
=====================================================================
1 24652U 96063A 96318.74847837 -.00000020 00000-0 00000+0 0 14
2 24652 3.9929 210.6007 7281127 177.7757 190.4436 2.27277888 06
1 24652U 96063A 96319.62211352 -.00000020 00000-0 00000+0 0 31
2 24652 3.9929 210.3183 7284735 178.4392 185.2995 2.27373269 12
1 24652U 96063A 96319.62351606 .00008082 00000-0 30835-2 0 24
2 24652 3.9764 210.1654 7280836 178.5436 186.6267 2.27380102 20
1 24652U 96063A 96319.62356237 .00009638 00000-0 38025-2 0 37
2 24652 3.9632 210.3512 7280110 178.4006 186.6625 2.27374993 25
1 24652U 96063A 96320.05952563 -.00002597 00000-0 -98092-3 0 63
2 24652 3.9623 210.1661 7275699 178.7092 185.6294 2.27896863 39
{end of file}

Accepted Answer

Tom
Tom on 12 Sep 2012
I'm not completely sure what you mean, but to access the induvidual characters in each cell you just had to index within that cell:
Data{1,3}(1:2) %96
Data{1,3}(3:4) %06
Data{1,3}(5:6) %3A
Note that the numbers are still strings not numeric, you can use str2double or str2num to convert.
  2 Comments
Hamza
Hamza on 14 Sep 2012
And how can I display and store in a single variable of all the elements of all rows and 4th column as they are changing in every line?

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Conversion 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!