|
On Nov 11, 2:10=A0pm, kates <wa...@ukm.my> wrote:
> Dear Matlaber
>
> I have sensor data reading as follows:
>
> -SENSOR/DESCRIPTION
> *-------------------------
> =A0GOLD 08:01:00 108.5
> =A0GOLD 08:01:06 086.6
> =A0GOLD 08:01:12 085.0
> =A0GOLD 08:01:18 080.3
> =A0-/ Finish
> =A0+ (c) thank you
>
> I use the following syntax to read the data (in txt file):
> [sensor,hour,min,sec,param]=3Dtextread('sensor.txt','%4s %2d:%2d:%2d %f',=
'delimiter',',','headerlines',2,'endofline','\n');
>
> Output: ??? Trouble reading literal string from file (row 1, field 5) =3D=
=3D> 1:00 108.5\n
>
> Do you have another way? Your time to response this small problem is appr=
eciated.
>
> =3D=3Dkate
Can I suggest you use textscan instead?
fid =3D fopen('sensor.txt', 'r')
C =3Dtextscan(fid, '%s %d:%d:%d %f\n', 'headerlines', 2)
fclose(fid)
C is a cell array of vectors containing the various things ... e.g.
C{1} would be sensor, C{2} hour, C{3} minute, etc.
Hope that helps,
Richard
|