|
From: | Markus Bergholz |
Subject: | Re: How to plot two graphs with a textfile with a textdocument with two x two columns? |
Date: | Fri, 14 Mar 2014 23:48:50 +0100 |
On Fri, Mar 14, 2014 at 10:42 PM, Conrad Kopernikus <address@hidden> wrote:
Dear Community,
with some physic experiments with picoscope I get a textfile (.txt) with two
columns. But I have to graphs. My textfile look a littlebit like that:
Channel A
Time Value
(ms) (mV)
3 6305
19 6178
34 6081
50 5905
66 5758
81 5641
97 5592
112 5573
Channel B
Time Value
(ms) (mV)
3 8864
19 8796
34 8786
50 8786
66 8816
81 8786
97 8786
112 8737
The columns are larger in reality. But how to plot that? I delete the text
and copy the columns for the first graph in a new text-file and the second
in a new text-file. I load both textfiles use the x1=(:,1) and get a plot
like: plot(x1,y1,x2,y2). That works. But is their a faster way to do that?
Can I just use one and same textfile ... but just say to octave it should
make to graphs instead of connecting them?
octave:1> f=fopen('conrad.txt' )f = 3octave:2> raw=fread (f, "char=>char").'raw = Channel ATime Value(ms) (mV)3 630519 617834 608150 590566 575881 564197 5592112 5573Channel BTime Value(ms) (mV)3 886419 879634 878650 878666 881681 878697 8786112 8737octave:3> rawvalues=regexp(raw,"[0-9]+",'match')rawvalues ={[1,1] = 3[1,2] = 6305[1,3] = 19[1,4] = 6178[1,5] = 34[1,6] = 6081[1,7] = 50[1,8] = 5905[1,9] = 66[1,10] = 5758[1,11] = 81[1,12] = 5641[1,13] = 97[1,14] = 5592[1,15] = 112[1,16] = 5573[1,17] = 3[1,18] = 8864[1,19] = 19[1,20] = 8796[1,21] = 34[1,22] = 8786[1,23] = 50[1,24] = 8786[1,25] = 66[1,26] = 8816[1,27] = 81[1,28] = 8786[1,29] = 97[1,30] = 8786[1,31] = 112[1,32] = 8737}octave:4> cellvalue=cellfun (@str2double, rawvalues, 'UniformOutput', false)cellvalue ={[1,1] = 3[1,2] = 6305[1,3] = 19[1,4] = 6178[1,5] = 34[1,6] = 6081[1,7] = 50[1,8] = 5905[1,9] = 66[1,10] = 5758[1,11] = 81[1,12] = 5641[1,13] = 97[1,14] = 5592[1,15] = 112[1,16] = 5573[1,17] = 3[1,18] = 8864[1,19] = 19[1,20] = 8796[1,21] = 34[1,22] = 8786[1,23] = 50[1,24] = 8786[1,25] = 66[1,26] = 8816[1,27] = 81[1,28] = 8786[1,29] = 97[1,30] = 8786[1,31] = 112[1,32] = 8737}octave:5> matvalue=cell2mat (cellvalue )matvalue =Columns 1 through 23:3 6305 19 6178 34 6081 50 5905 66 5758 81 5641 97 5592 112 5573 3 8864 19 8796 34 8786 50Columns 24 through 32:8786 66 8816 81 8786 97 8786 112 8737octave:6>
[Prev in Thread] | Current Thread | [Next in Thread] |