[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Editing .txt file in Octave
From: |
Stefan Neumann |
Subject: |
Re: Editing .txt file in Octave |
Date: |
Fri, 19 Mar 2010 00:45:09 +0100 |
This seems to work:
--- datafile 'foo.dat' ---
1m
1n
1u
--- script 'dats.m' ---
infile="foo.dat";
[fid] = fopen(infile, "r") ;
[m, count] = fscanf(fid, '%f%c',[2,3]);
fclose(fid);
m=m';
m
for i=1:size(m(:,2))
if(m(i,2)==109) m(i,1)*=1e-3; endif
if(m(i,2)==110) m(i,1)*=1e-9; endif
if(m(i,2)==117) m(i,1)*=1e-6; endif
endfor
m
vals=m(:,1);
vals
--- this is what happens (chatter deleted) ---
MYPC$ octave dats.m
m =
1 109
1 110
1 117
m =
1.0000e-03 1.0900e+02
1.0000e-09 1.1000e+02
1.0000e-06 1.1700e+02
vals =
1.0000e-03
1.0000e-09
1.0000e-06
Cheers
stn
- Editing .txt file in Octave, socware, 2010/03/17
- RE: Editing .txt file in Octave, dastew, 2010/03/17
- RE: Editing .txt file in Octave, socware, 2010/03/18
- Re: Editing .txt file in Octave, Stefan Neumann, 2010/03/18
- Re: Editing .txt file in Octave, John W. Eaton, 2010/03/18
- Re: Editing .txt file in Octave, Stefan Neumann, 2010/03/18
- Re: Editing .txt file in Octave, John W. Eaton, 2010/03/18
- Re: Editing .txt file in Octave,
Stefan Neumann <=
- Re: Editing .txt file in Octave, socware, 2010/03/23
- RE: Editing .txt file in Octave, Mike Miller, 2010/03/18