How to store data without deleting previous one

2 ビュー (過去 30 日間)
María Pérez Fernández
María Pérez Fernández 2022 年 10 月 15 日
編集済み: Voss 2022 年 11 月 24 日
I'm writing a program using App Designer that allows you to select a ROI using drawfreehand in a picture, then switch to the next picture using a "NEXT" button and draw over it again. For the drawfreehand function I have another button named ('DRAW').
I need to store the binary masks of the selected ROIs so I can use them later, but when I try to do it the program only saves the one from the last picture and deteles the previous ones.
How can I solve this?
Here is my code:
function NEXT(app, event)
%this function works fine to switch to the next image
if app.num<k
app.num=app.num + 1;
ISig = dicomread(app.complete{app.num});
function DRAW(app, event)
save mask.mat mask
% app.num is a property that indicates de index of the image displayed and
% k represents the number of images loaded
  4 件のコメント
María Pérez Fernández
María Pérez Fernández 2022 年 11 月 23 日
I have done this but when I load mask.mat it only contains the last mask created, and all the other entrys are zero.
Thank you very much



Voss 2022 年 11 月 23 日
mask is a variable that only exists in the workspace of the DRAW function. In other words, each time DRAW is executed, a new mask variable is created and saved to the mat file.
To save the values of mask from multiple executions of DRAW, you can make mask an app property.
  2 件のコメント
Voss 2022 年 11 月 24 日
編集済み: Voss 2022 年 11 月 24 日
You're welcome!


その他の回答 (0 件)




Community Treasure Hunt

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

Start Hunting!

Translated by