How to read data from dat file and plot ?

99 ビュー (過去 30 日間)
Kathy 2017 年 5 月 24 日
回答済み: 10B 2017 年 5 月 26 日
I want to read the data from the dat file. Skip first 5 lines and read after that. Finally I want to plot 3 columns from the data . Here is the sample data
"BBB5","BNOO_W2_KIOP_IP","CV1000","79598","TY1000.Ltd.29","CPU:tmid2.cr1","19501","KRS_Step" "TIMESTAMP","Data","SDF_Counter","_Mthu232","_WF232Drrt","Parms(1)","Parms(2)","Parms(3)","Parms(4)","Parms(5)","Parms(6)","Parms(7)","Parms(8)","Parms(9)","Parms(10)","Parms(11)","Parms(12)","Parms(13)" "LS","RTY","","","","","","","","","","","","","","","","" "","","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp","KPp" "2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 "2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 "2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28

回答 (1 件)

10B 2017 年 5 月 26 日
Hello Kathy,
I think you want to read this answer from Walter: which explains how to do it.
Then plotting should be straightforward. I would save the output data as variables, XY, then take a look at "doc plot", called by writing it in the worksapce.
Remember that Matlab works in order of row then column so if you wanted to plot the 6th row against all columns you would write plot(X(6,:)); or similar, depending on how your data was arranged as variables.
Hope that helps. Give it a try and see how you get on.



Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by