How do I make multiple variables into one csv file?

조회 수: 13 (최근 30일)
Anthony
Anthony 2015년 2월 3일
댓글: Image Analyst 2015년 2월 3일
Hi everyone,
Probably a simple question, but I have about 9 variables that are all separated that I would like to compact into a single CSV file with the variable names as headers. Is there an easy function to do this so that I can load the data outside of Matlab?

답변 (1개)

Image Analyst
Image Analyst 2015년 2월 3일
See the first example on writing a text file in the help for writetable(). It does exactly what you want.
writetable(yourTable, filename);
  댓글 수: 2
Anthony
Anthony 2015년 2월 3일
Though now when I'm trying to make the separate arrays into a table, I'm getting the following error. Undefined function 'table' for input arguments of type 'double'.
Image Analyst
Image Analyst 2015년 2월 3일
Then you must have an old version of MATLAB, earlier than R2013b. So you can simply use fopen(), fprintf(), and fclose(). Examples are in the help. It's not hard like 3-5 lines of code.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by