Info
此问题已关闭。 请重新打开它进行编辑或回答。
Import Data using function
1 次查看(过去 30 天)
显示 更早的评论
I want to import 2 .DAT into my code using a function When using the import wizard i make it a point to neglect the textdata here is a small exert of the files
XAXIS ZAXIS Eintensity Hintensity Sintensity
-1.50000000 -1.50000000 1.04858450 0.88251762 0.96197417
-1.47000000 -1.50000000 1.05946741 0.90707882 0.98031650
-1.44000000 -1.50000000 0.98867187 1.03632028 1.01221574
-1.41000000 -1.50000000 0.98153259 1.06804583 1.02387586
-1.38000000 -1.50000000 0.96053362 1.05617225 1.00721842
-1.35000000 -1.50000000 0.99755509 1.01285533 1.00517610
-1.32000000 -1.50000000 0.99126668 1.04608833 1.01830865
-1.29000000 -1.50000000 1.02578740 0.98220775 1.00376109
-1.26000000 -1.50000000 1.08350872 0.85828860 0.96434599
-1.23000000 -1.50000000 1.09498790 0.88392760 0.98381402
i've tried to use the load function but the text at the top of the file creates an error. I cannot change the file as it is hardcoded into another software.
Any ideas?
0 个评论
回答(2 个)
per isakson
2012-3-26
Why not use the wizard and just ignore or delete textdata?
Here is an alternative to textread. Doc says: "textread will be removed in a future version. Use textscan instead."
I copied your sample to 'h:\m\cssm\cssm.dat'.
I prefer to give Headerlines the value 2. In case I redefine Whitespace. That is if there is an empty line between the header and the data.
fid = fopen( 'h:\m\cssm\cssm.dat', 'r' );
cac = textscan( fid, '', 'Headerlines', 2 );
fclose( fid );
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!