Hi i need help in file conversion .txt to mat file
2 次查看(过去 30 天)
显示 更早的评论
I have some data collected on machine which is in .txt format. I want to convert it to a mat file. Here is what the data looks like
row1 Time 1_auto_mode 2_lift_target 3_ang_eve_mm 4_lift_command_per 5_LiftDir 6_CmdVel_mm_s 7_ACE_All_CtrlLaw_Switch 8_ACE_All_CtrlLaw_1_FL 9_ACE_All_CtrlLaw_2_L1AC 10_ACE_All_CtrlLaw_3_MRAC 11_ACE_All_CtrlLaw_4_PD 12_ACE_All_Target 13_ACE_All_BladeTipYDisp_RateTrasition 14_ACE_menu_target 15_ACE_mea_L1 16_ACE_mea_MRAC 17_ACE_lift_final_percent 18_lift_direct_final
row2 0.039991 0.000000 200000.000000 200380.000000 0.000000 0.000000 -3718.594742 4.000000 -3376.605662 -3538.103638 -7480609.559167 -3718.594742 200000.000000 200380.000000 10.000000 380.000000 380.000000 0.000000 0.000000
row3 0.059985 0.000000 200000.000000 200381.000000 0.000000 0.000000 -3743.363776 4.000000 -3508.938222 -3546.986694 -7493434.222546 -3743.363776 200000.000000 200381.000000 10.000000 381.000000 381.000000 0.000000 0.000000
similar fashion i have 2179 rows
can some one help me with this
1 个评论
Walter Roberson
2013-6-2
You are going to have to specify what is header, what is text in a column, which columns are numeric, which columns to be ignored...
Are "row1" and "row2" literal, or do you mean that the first row is what follows there (the 19 fields), and the second row is the series of numbers that follow on that line? I do count 19 numeric values.
回答(1 个)
Amith Kamath
2013-6-2
Although this may not be the best way to do this, but you can use IMPORTDATA to import all the data from the '.txt' file as a structure. This will save the text headers separately and the data separately. You can then save this structure as a '.mat' file. See: http://www.mathworks.com/help/matlab/ref/importdata.html
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!