Hi
I have 4 vectors (SIN, Y-COORD,X-COORD, AA20). How can I make a text file similar to the attached image.
Thanks

 채택된 답변

Mathieu NOE
Mathieu NOE 2021년 9월 21일

0 개 추천

hello
look at the attached files . I probably found that on FEX, but it seems to have disappeared

댓글 수: 6

M.R. Ebrahimi
M.R. Ebrahimi 2021년 9월 21일
Thanks. But I want to save as a text file. It is just for displaying in command window.
Rik
Rik 2021년 9월 21일
Since the function returns a char array if you ask it to, you can capture that and use fprintf to print this to a file.
M.R. Ebrahimi
M.R. Ebrahimi 2021년 9월 21일
It would appreciated if you write a simple code here to save the data as a text file.
Mathieu NOE
Mathieu NOE 2021년 9월 21일
편집: Mathieu NOE 2021년 9월 21일
try this
data = 1e2.*rand(5,4);
fmt = {'%.3g'};
col_headers = {'a','b','c','d'};
row_headers = {'No.','1','2','3','4','5'};
out = print_table(data,fmt,col_headers,row_headers)
% save to file
filename = 'exp.txt';
fileID = fopen(filename,'w');
fprintf(fileID,out);
fclose(fileID);
output in text file
No. | a | b | c | d
-----|------|------|------|------
1 | 37.6 | 59 | 29 | 73
2 | 19.1 | 22.6 | 61.7 | 34.4
3 | 42.8 | 38.5 | 26.5 | 58.4
4 | 48.2 | 58.3 | 82.4 | 10.8
5 | 12.1 | 25.2 | 98.3 | 90.6
M.R. Ebrahimi
M.R. Ebrahimi 2021년 9월 21일
Thanks
Mathieu NOE
Mathieu NOE 2021년 9월 21일
My pleasure

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

질문:

2021년 9월 21일

댓글:

2021년 9월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by