필터 지우기
필터 지우기

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