write double class to .txt file
36 次查看(过去 30 天)
显示 更早的评论
Let' say , I have the data in Matlab with the result is ha=14x3 double.
ha=[ 6.74483465234e+05 1.512013286060e+06 -11.6250
6.74483565235e+05 1.512013586059e+06 -11.1250
6.74483665235e+05 1.512013186059e+06 -11.6150
............................................................]
How can I convert "ha" to the file with extension file name .txt?
0 个评论
采纳的回答
ha ha
2018-6-21
编辑:ha ha
2018-6-22
1 个评论
Walter Roberson
2018-6-21
Two steps are not needed. If you already have ha then just the dlmwrite() would be needed.
更多回答(1 个)
Walter Roberson
2018-6-21
save YourFileNameGoesHere.txt ha -ascii -double
3 个评论
Walter Roberson
2018-6-21
Which MATLAB release are you using? And is it possible there was a special character in the file name?
>> ha = rand(14,3)
ha =
0.564311118993862 0.817996881165875 0.4914408954708
0.886208766442231 0.916848547977997 0.586965769028758
0.540386873298003 0.704906196238206 0.382831659385335
0.741939008541082 0.713764731668324 0.220845951876804
0.363907275377093 0.0580101724585301 0.918355702076729
0.638543500573447 0.644690448569641 0.0871660376642051
0.156344591720558 0.930698521135438 0.800057722205667
0.559201781113188 0.449742685010024 0.476716144812095
0.403763678573054 0.849106807977924 0.0535249742035238
0.265807233888716 0.663712003994611 0.554110729632032
0.130106666955534 0.0349694247231292 0.876998654274985
0.343754546565382 0.528773374253961 0.555621900932396
0.800416117923546 0.0481754648350227 0.292102339706884
0.259467705281624 0.717624324039735 0.493149570541529
>> save YourFileNameGoesHere.txt ha -ascii -double
>> !cat YourFileNameGoesHere.txt
5.6431111899386210e-01 8.1799688116587477e-01 4.9144089547079994e-01
8.8620876644223134e-01 9.1684854797799731e-01 5.8696576902875774e-01
5.4038687329800261e-01 7.0490619623820627e-01 3.8283165938533514e-01
7.4193900854108186e-01 7.1376473166832366e-01 2.2084595187680411e-01
3.6390727537709278e-01 5.8010172458530129e-02 9.1835570207672856e-01
6.3854350057344667e-01 6.4469044856964086e-01 8.7166037664205054e-02
1.5634459172055792e-01 9.3069852113543838e-01 8.0005772220566729e-01
5.5920178111318763e-01 4.4974268501002368e-01 4.7671614481209534e-01
4.0376367857305351e-01 8.4910680797792426e-01 5.3524974203523756e-02
2.6580723388871619e-01 6.6371200399461117e-01 5.5411072963203234e-01
1.3010666695553419e-01 3.4969424723129250e-02 8.7699865427498491e-01
3.4375454656538218e-01 5.2877337425396143e-01 5.5562190093239616e-01
8.0041611792354628e-01 4.8175464835022663e-02 2.9210233970688437e-01
2.5946770528162444e-01 7.1762432403973464e-01 4.9314957054152853e-01
另请参阅
类别
在 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!