LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to append data on matfile using matlab Datapluggin in LabView?

Dear all,

 

I am trying to append data in a matfile using matlab datapluggin in LabView.

 

- First step: I open or create a new matfile (C:\Example.mat)  --> OK

- Then I create a channel group (No name because all the channels after will have a name and the datapluggin concatenate the 2 strings).  --> OK

- Then I create 4 channels. My for loop will permit to add a value and a name for each channel. --> Not ok, only work if the matfile is created, not opened.

- So, for this application, I first create a matfile which is OK, but when I try to open it later, it's not working.

- Then I close the session --> OK

 

So, how to append data on matfile using matlab Datapluggin in LabView?

 

I attached my program as example. This is not the final program of my application but it behaves in the same way (it's just a debug program).

 

Software used:

LabView 2014

USI_MATLAB 1.3.06185 (data pluggin)

 

Thank you for the time you will consider to this request.

 

Best regards.

 

Jimmy

 

 

 

0 Kudos
Message 1 of 3
(2,901 Views)

Hey Jimmy,

 

I played a little with the VI which you attached to your post.

I think that you can only append data to a .mat file, if you have created the corresponding matfile during the run of the program. I also don't found a way to append data to an existing file.

I think it is not possible to open an existing file with the Data Plugin API and append data to that file. It only works, if the file is created and not opended.

If you want to attach data to an existing file, it seems to be necessary to load the existing matfile, read the content, create a new file, write the existing content into it and append the new data set.

 

Regards, Stephan

0 Kudos
Message 2 of 3
(2,857 Views)

Hi Stephan,

 

thank you for your answer. I think you are right and we can only append data to a file that has been created with this API.

For my application, I decided to append data on a .txt file and then create a matfile at the end, after the sequence is finished.

 

Kind regards.

 

Jimmy

0 Kudos
Message 3 of 3
(2,836 Views)