필터 지우기
필터 지우기

how to export a matrix

조회 수: 6 (최근 30일)
Negar
Negar 2015년 1월 31일
댓글: Star Strider 2015년 1월 31일
hi all, i'm trying to export a matrix "f" that is double. My data in f are real numbers in three columns. I want a txt file as an output with the columns separated by tabs. but when I try dlmwrite function, just the first column appears as output.
for k = 1:10
f = [idx', firsttime', sectime'];
filename = strcat(('/User/Detection_rerun/AF_TIMIT/1_state/mergedlabels_train/'),(files_train{k,1}),'.lab');
dlmwrite(filename,f,'\t') ;
end
when I write is as dlmwrite(filename,f,'\t','newline','pc') ; I keep getting an error Invalid attribute tag: \t . I even tried 'tab' instead of '\t' but a similar error appears. Please let me know if you have any suggestions. thank you

채택된 답변

Star Strider
Star Strider 2015년 1월 31일
You have to specify the delimiter as part of a name-value pair.
Example from the documentation for dlmwrite:
dlmwrite('myFile.txt',M,'delimiter','\t','precision',3)
  댓글 수: 2
Negar
Negar 2015년 1월 31일
Ohh thank you, Its working now
Star Strider
Star Strider 2015년 1월 31일
My pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by