From: Francki on
"Francki " <jonesfranckandi(a)yahoo.fr> wrote in message <i3ce40$mjb$1(a)fred.mathworks.com>...
> Hi guys,
>
> basically I've some data in a text file called "Raw Data". Raw Data has the following data:
>
> BUT IN/OUT 1 12 34.4
> JON IN 2 13 35.67
> GER IN/OUT 3 14 98.8
> GRO OUT 4 15 67.6
> FRE OUT 5 16 45.0
> TRE IN 6 17 67.03
> PIU IN/OUT 7 18 78.46
>
> Now I have a code that reads this data. Upon reading i want matlab to return in a matrix form the names and numbers of all those that have 'OUT' or 'IN/OUT'. say something like this:
>
> GER 3 14 98.8
> GRO 4 15 67.6
> FRE 5 16 45.0
> PIU 7 18 78.46
> BUT 1 12 34.4
>
> or in seperate matrices:
>
> 3 14 98.8 GER
> 4 15 67.6 GRO
> num = 5 and lap= 16 and time= 45.0 and name= FRE
> 7 18 78.46 PIU
> 1 12 34.4 BUT
>
>
> here is the code i've got:
>
> file=importdata('RawData.txt');
>
> d=file.textdata;
> r=[d(:,1) d(:,2)];
> a=file.data;
> z=[a(:,1) a(:,2) a(:,3)];
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> %%%%%%record data%%%%%%%%%%%%
>
> for i=1:length(d(:,2))
>
> cp= strcmp(char(r(i,2)),'OUT');cp1= strcmp(char(r(i,2)),'OUT/IN');
> cp2= strcmp(char(r(i,2)),'IN');
>
> if cp==1 || cp1==1
>
> stoplapout=z(i,2);
> outlapt=z(i,3)%%%outlap
>
> elseif cp2==1 || cp1==1
>
> carnum=z(i,1); %%%%carnumber
> driver=r(i,1);%%%%%driver
> stoplap=z(i,2);%%%%stop lap
> inlapt=z(i,3); %%%%inlap
> end
> end
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> matlab returns the right values but doesn't assemble data into matrix form (all it does is i.e.carnum=1; carnum=3; carnum=5, etc.....
>
> Can anyone help me get around this pesky problem?.....all help are massively appreciated.

Everyone's input would be mostly appreciated.....help if you can!!....

safe all
From: Francki on
"Francki " <jonesfranckandi(a)yahoo.fr> wrote in message <i3gd18$q2p$1(a)fred.mathworks.com>...
> "us " <us(a)neurol.unizh.ch> wrote in message <i3ciu2$t65$1(a)fred.mathworks.com>...
> > "Francki "
> > > It's not exactly what I'm looking for but thanks.....I can take it from here on.
> > >
> > > Safe
> >
> > just to be sure: the snippet certainly reproduces your first example...
> > did you tell the whole story(?)...
> >
> > us
>
> Sorry for the late reply but I have another favour....is it possible for your code to be modified so that the computer of those who don't have "in" into that matrix and replacing it by zero....like this:
> 'BUT' [1] [12] [ 34.4]
> 'BUT' [1] [12] [0]
> 'GER' [3] [14] [ 98.8]
> 'GER' [3] [14] [ 0]
> 'GRO' [4] [15] [ 67.6]
> 'GRO' [4] [15] [0]
> 'FRE' [5] [16] [ 45]
> 'FRE' [5] [16] [ 0]
> 'PIU' [7] [18] [78.46]
> 'PIU' [7] [18] [0]
>
> any help would be greatly appreciated!!.

anyone at all....help a buy in need here