フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Replace a string in a file with a 1D array--please don't close it

1 回表示 (過去 30 日間)
H R
H R 2016 年 1 月 4 日
閉鎖済み: Walter Roberson 2016 年 1 月 4 日
Hi all,
Please help me with this question. I have been trying to find a simple way to do so. Please don't close this.
I have a 1D number array with N numbers say A=[1,2,3,4,5,6,7,8,9,10,...100]; I have a text file 'Test.txt'. Inside the text file I have a string [$1].
Data
[$1]
/
How to replace the string [$1] with the content of the array A in such a way that the array content is written one after each other in multiple lines where only 6 space-delimited numbers are printed in each line except the last line that could be shorter than 6 numbers (depending on the size of A). After this I would like to save the file with other name say 'Test1.txt' with the following contents:
Data
1 2 3 4 5 6
7 8 9 10 11 12
13 14 15 16 17 18
...
/

回答 (0 件)

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by