Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8395681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:21:42+00:00 2026-06-09T20:21:42+00:00

I need to save some data to an existing table. So i have column

  • 0

I need to save some data to an existing table. So i have column names and one row that has data. Now I get the second set of information and i need to put it in the second row and so on.
Can you just point me where i can find this.
I have done this so far. Played arround with save( -struct) but doesn’t seem to work.

if exist('table.mat','file')
...
...
else
    dataCell = [name,trez,score];
    colNames = {'Name','R','G','B','Shape'};
    uisave({'colNames','dataCell'},'table');
end

So I check if there is table.mat, if there is none it creates it with some passed values. Now table.mat exists I need to put the second values without deleting other values.

UPDATE

OK i made the code like this:

if exist('table.mat','file')
        dataCell = [name,num2cell(trez),num2cell(score)];
        save('table.mat', '-append','dataCell');
    else
        dataCell=[name,num2cell(trez),num2cell(score)];
        colNames={'Name','R','G','B','Shape'};
        uisave({'colNames','dataCell'},'table');
    end

But when i do save data using :

   dataCell = [name,num2cell(trez),num2cell(score)];
   save('table.mat', '-append','dataCell');

It deletes the old entry. Lets say in my table information is as it follows :

Name | R | G | B | Shape |

Orange | 239 | 135 | 2 | 0.87

Then if I try to save another entry like :

Apple | 100 |31 |56 | 0.79

It deletes the Orange. So do i need to add something or use some other method for this kind of information saving?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:21:44+00:00Added an answer on June 9, 2026 at 8:21 pm

    The save command can take an -append flag, which allows you to add data to existing files without overwriting old data. However for .mat files -append only allows you to add new variables. If you specify a variable name that already exists in the .mat file it will be overwritten.

    However, if you are saving to an ASCII file then data is simply appended to the end of the file.

    This presents you with two options.

    1. Save using a .mat file, but for each variable you want to save you would need to load any variables with the same name from the .mat file, combine old variable with the new variable and then resave it to the file.
    2. Save the matrices using an ASCII format, and then convert the from ASCII when you load the file.

    Update: After re-reading your original question, I have to ask why not save in a single operation rather than saving line by line?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My App need to save some data (around 100 double fields that is stored
Here's the question. I have a table where I save some data, which I
I have three buttons and need to save some data. I have a idea,
in my app i need to save some data. Right now i use CoreData,
I have an activity that uses AsyncTask to download and save some data to
I need to save some classes and data structures to a file. My first
I want to save some custom data into application configuration file and I need
need to save some persistent data. the data would only contain 3 or 4
I need to save some data in my application, when the application terminates and
I need to save some data in a file and when loading the page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.