Didn't find a good explanation.
Suppose we have an array R=[..,..,..] How to save this single array to a .txt file? Thank you.

댓글 수: 2

Jan
Jan 2016년 9월 26일
It depends on the contents of the variable. If it e.g. a nested struct or cell array, you need another approach than for a simple string. How should the created file look like?
Vadim Tambovtsev
Vadim Tambovtsev 2016년 9월 26일
Array(n,1)
Just like a column of numbers, the question is still actual, please answer.

댓글을 달려면 로그인하십시오.

 채택된 답변

Geoff Hayes
Geoff Hayes 2016년 9월 26일

3 개 추천

Vadim - try using fprintf. For example,
% open your file for writing
fid = fopen('myTextFile.txt','wt');
% write the matrix
myData = randi(255,10,3);
if fid > 0
fprintf(fid,'%d %d %d\n',myData');
fclose(fid);
end
The above is a very simple example that is based on the examples in the provided link so see that link for more details.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품

질문:

2016년 9월 26일

댓글:

2016년 9월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by