How to save or convert a simulink model to csv file

Hi all,I have a tank system in simulink and would like to save or convert it to a csv file.Does anyone know how this can be done?

 채택된 답변

Kaustubha Govind
Kaustubha Govind 2012년 3월 23일

0 개 추천

A .csv file is typically a text-file with comma-separated numerical values - how can a Simulink model be represented simply in terms of numerical values? AFAIK, such a conversion is not possible.

댓글 수: 1

Joseph
Joseph 2012년 3월 23일
Thanks Govind for your answer.What would you advice in this situation,i want to communicate with labview via shared memory as i dont have the instrument control toolbox to communicate with labview via TCP/IP.In what format can i save the file in a particular location for labview to be able to read it?Dont know if you understand what i am trying to do

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

추가 답변 (3개)

Joseph
Joseph 2012년 3월 23일

0 개 추천

Thanks Govind for your answer.What would you advice in this situation,i want to communicate with labview via shared memory as i dont have the instrument control toolbox to communicate with labview via TCP/IP.In what format can i save the file in a particular location for labview to be able to read it?Dont know if you understand what i am trying to do
K E
K E 2012년 3월 23일

0 개 추천

Are you trying to pass the output of a Simulink model into LabView, such as a time series of simulated position and velocity? If so then you can use a To Workspace block in your Simulink model to pass the time series out of Simulink and into Matlab's workspace, then in Matlab you could save the variable to a CSV file using a Matlab utility such as csvwrite. Then you could read the resulting csv file into LabView. There are other ways to go from [Simulink time series] to [saved csv file]; this is one example.

댓글 수: 3

K E
K E 2012년 3월 26일
Alternatively you can save the Simulink output to a *.mat file using the 'To File' block (http://www.mathworks.com/help/toolbox/simulink/slref/tofile.html). Perhaps there is a LabView utility to read a mat file into LabView. Or, you could add a function block to your Matlab model that uses fprintf or csvwrite to export the data, but see Fangjun's warning about it here,
http://www.mathworks.com/matlabcentral/answers/15982-how-to-store-output-data-from-a-simulink-model-to-a-text-file
Joseph
Joseph 2012년 3월 26일
Thanks
K E
K E 2012년 3월 26일
Here is a thread on reading a mat file into Labview,
http://forums.ni.com/t5/LabVIEW/I-want-to-read-a-Matlab-MAT-file-into-labview/td-p/322423
Since I am not a Labview user, you would want to follow up in that forum with any followup Labview questions.

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

Joseph
Joseph 2012년 3월 26일

0 개 추천

Hi KE,thanks for you answer to my question about converting a simulink model into a csv file.What i really want to do is that,i have a tank model in simulink and the user interface of this tank model will be in Labview.Since i dont have the instrument control toolbox to communicate via TCP/IP i want a situation where i can write the input and output of the tank to a file,Labview will read from that file and display that on the user interface.Labview too will also write to a file and simulink will read from that file.Do you think this can be done?Thanks and hope you understand what i am trying to say.Dont want to go through Matlab

댓글 수: 1

This might be of help: Building a LabVIEW User Interface for a Simulink® Model with LabVIEW Simulation Interface Toolkit (http://zone.ni.com/devzone/cda/tut/p/id/3057).

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by