hi. i have two variables which are AREA and PERIMETER.

how to save both variables in a mat.file? i only have coding for one variable only :
_ _ _objArea = objMeasurements(k).Area; % Get area.
AREA=[objArea;AREA];
save('AREA.mat','AREA');
objPerimeter= objMeasurements(k).Perimeter; % Get perimeter.
PERIMETER=[objPerimeter;PERIMETER];
save('PERIMETER.mat','PERIMETER');___

1 Comment

Save all the variables into a single matrix. Then you can save it as a Mat

Sign in to comment.

 Accepted Answer

save(Filename, 'AREA', 'PERIMETER')

3 Comments

i already tried it. but it only save in MAT.file but different folder. i want AREA and PERIMETER together in two column in one MAT.file.For example, 14X2.
You can specify a folder name when you save().
To save both values as columns in a single variable:
AREA_PERIMETER = [AREA, PERIMETER];
save(Filename, 'AREA_PERIMETER');
thank youuuuu so much!

Sign in to comment.

More Answers (1)

You could do this in two calls:
save(filename,'AREA')
... other code
save(filename,'PERIMETER','-append')
OR in one call:
save(Filename, 'AREA', 'PERIMETER')

1 Comment

i already tried it. but it only save in MAT.file but different folder. i want AREA and PERIMETER together in two column in one MAT.file. i want 14X2.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 13 Oct 2015

Commented:

on 15 Oct 2015

Community Treasure Hunt

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

Start Hunting!