about function rats and how to output to .txt
2 ビュー (過去 30 日間)
古いコメントを表示
In Figure 1, I want to express the number of numbers in my file (test1.txt) plus pi
![擷取.JPG](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247767/%E6%93%B7%E5%8F%96.jpeg)
For example: -1.17809724509617 convert to -3/8*pi
The problem I am having now is that I have a large space after using rats.
Causes me to output to txt when there is a comma in front like Figure 2
![72714257_2227369354035516_2028957041850056704_n.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/247768/72714257_2227369354035516_2028957041850056704_n.jpeg)
what should I do?
0 件のコメント
採用された回答
Adam Danz
2019 年 11 月 11 日
a1 = strtrim(rats(a/pi));
Use strtrim() to remove leading and trailing white space.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!