Can csv write multiple arrays into file at one time?

조회 수: 17 (최근 30일)
tom Diehl
tom Diehl 2014년 9월 13일
댓글: Talhah 2016년 6월 12일
I want to output two 1-column arrays in Simulink to a single 2 column csv file. I am currently using the stopfunc in simulink to create 2 1-column csv files then having to put them together myself. Any help would be greatly appreciated.

채택된 답변

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014년 9월 13일
Hi tom,
You can definitely do it.
You just need to arrange your data
Say you have two set of data, each is in form of a column, then you can put them together, more accurately concatenating them and then write it to a csv file
newdata = [column1,column2];
csvwrite('yourfile',newdata)
I believe that's all you need to do
check these in MATLAB documentation, to find out more about concatenating.
doc horzcat
doc vertcat
I'm afraid I'm not good at simulink, but definitely there is a block that concatenates these two columns in your desired fashion.
Good Luck!
  댓글 수: 1
Talhah
Talhah 2016년 6월 12일
Awesome Solution thanks. You just made my day

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by