To save Output array in the arranged form

조회 수: 1 (최근 30일)
Syed Muntazir Mehdi
Syed Muntazir Mehdi 2015년 11월 27일
댓글: Syed Muntazir Mehdi 2015년 11월 27일
Hello Brothers and sisters!
Actually my problem is that I wish to save the output data from my code in an arranged form, Although I am getting the arranged form of my output data but the problem is that it only appears when I open that output.txt file in Matlab and when i wants to open that text file out of the matlab environment, It just gives me numbers without any order and the shape of matrix no more exists.
The second thing is can we save our data (arrays) directly into an excel sheet? If yes, Please tell me the way
I shall be thankful.

채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 27일
For the first question:
You might currently have an fopen() statement that looks something like
fid = fopen('SomeFileName.txt', 'w');
If you do, then change that line to
fid = fopen('SomeFileName.txt', 'wt');
Possibly instead you are using dlmwrite() with something that looks like
dlmwrite('SomeFileName.txt', YourArray);
If you do, then change that line to
dlmwrite('SomeFileName.txt', YourArray, 'Newline', 'pc');
Possibly instead you are using csvwrite() with something that looks like
csvwrite('SomeFileName.txt', YourArray);
If you do then change the csvwrite() to dlmwrite and add the 'Newline', 'pc' option,
dlmwrite('SomeFileName.txt', YourArray, 'Newline', 'pc');
For the second question:
You can use xlswrite() to write directly into .xls or .xlsx format.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by