Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
mat files append

Subject: mat files append

From: Snow White

Date: 24 Apr, 2009 16:36:01

Message: 1 of 2

Hi,

I am trying to append data into a mat file as it gets computed using the following code

savefile = 'test.mat';
if exist('test.mat')
    save(savefile, 'x','y','polang','I_max','I_min','temp_rho', 'A','B','C','r','-append');
else
    save(savefile, 'x','y','polang','I_max','I_min','temp_rho', 'A','B','C','r','-append');
end

but it overwrites the data and does not append it.

Bye

Subject: mat files append

From: Yi Cao

Date: 1 May, 2009 16:16:01

Message: 2 of 2

"Snow White" <gulesaman@gmail.com> wrote in message <gsspph$6p3$1@fred.mathworks.com>...
> Hi,
>
> I am trying to append data into a mat file as it gets computed using the following code
>
> savefile = 'test.mat';
> if exist('test.mat')
> save(savefile, 'x','y','polang','I_max','I_min','temp_rho', 'A','B','C','r','-append');
> else
> save(savefile, 'x','y','polang','I_max','I_min','temp_rho', 'A','B','C','r','-append');
> end
>
> but it overwrites the data and does not append it.
>
> Bye

-append option is to append new variables to the existing file but is not to append existing variables with new values. If you wish to append new values to the existing variables, you have to load these existing variables first, appending them in the workspace then to save appended variables to the existing mat file.

HTH
Yi Cao

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us