Some pointers with textscan?
    3 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
Hi,
I've been trying to import a data file (a nasty one) and convert it to rows can columns. But I feel that textscan dumps my data into one big column, which is what I don't want.
A snippet of my data file is as follows:
    'GP31M V1.25 031115B'
    'L   2        BH1  W M0.0'
    'T   03/11/2013 15:49:08'
    '@,235051.00,7119.963154,N,15640.819460,W,2,09,1.0,15:50:38.91'
    'SH10       1.000   222.750    20.478 15:50:39.19'
    '@,235052.00,7119.963153,N,15640.819483,W,2,09,1.0,15:50:39.74'
    '@,235103.00,7119.962785,N,15640.820648,W,2,09,1.0,15:50:50.78'
    'SH10       2.000   222.250    20.478 15:50:51.49'
    '@,235104.00,7119.962781,N,15640.820656,W,2,09,1.0,15:50:51.76'
    '@,235111.00,7119.962351,N,15640.821861,W,2,09,1.0,15:50:58.68'
    'SH10       3.000   221.250    20.478 15:50:59.51'
    '@,235112.00,7119.962354,N,15640.821875,W,2,09,1.0,15:50:59.78'
where the first three lines are a header, and if you look at the next three lines, the data in the second line is what I need in 5 separate columns, and the file repeats every three lines, where the data I need occurs every second line.
I'm following this approach (it's not done) according to example code (and I hope this posts correctly):
clc
clear all
close all
%importing in the data - raw read
fileID = fopen('031115B.G31', 'r');
Data = textscan(fileID, '%s', 3, 'delimiter', '\n');
Intro=Data{1};
disp(Intro);
Block=1;
while (~feof(fileID)) % For each block:
    sprintf('Block: %s', num2str(Block));            % Display block number
    InputText=textscan(fileID,'%s',1,'delimiter','\n'); % Read header line
    HeaderLines{Block,1}=InputText{1};          
    disp(HeaderLines{Block});
end
fclose(fileID);
Is there something that I can try to strip down the data file and break the data down into separate columns as discussed above?
Thanks!
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Data Type Conversion in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

