Reputation: 31
I am dealing with a class project and am in need of saving different values for the same variables each time the script is run. The script takes an input picture of a lego and outputs size, color, shape. These values need to be saved in a table of any sort that when the script is run again with a different picture, all the new values are added to the "inventory" list.
Here is the bottom portion of the script. I've been trying to play with the save feature only to find that it only replaces the values for the current variables in the .mat
every time the script is run. Hopefully this is enough to assist me. Thank you in advance.
size = area_width * area_length ;
%%%%%% make sure smaller dimension always first %%%%%
% width = smaller length
% length = longer length
Cell = {Color, size, shape, x_length, y_length};
% for iterations 1:block_count
% if Final = {Color, size, shape, x_length, y_length}
disp(Cell)
SaveData = sprintf('%s, %d, %s, %s, %s', Color, size, shape, x_length, y_length)
save('Data.mat', 'SaveData','-append')
Upvotes: 0
Views: 1028
Reputation: 556
Before running this script, do this on command line-
data={};
save('Data.mat','data');
And then-
SaveData = {sprintf('%s, %d, %s, %s, %s', Color, size, shape, x_length, y_length)};
load('Data.mat');
data = [data; SaveData];
save('Data.mat', 'data');
Upvotes: 1