MATLAB: Saving a logical mask

digital image processingimage processingImage Processing Toolboxlogical maskmatricesmatrixregion of interest

I have a code for creating a logical mask and calculating values inside the ROI of the mask. My query is: is it possible to save the logical mask to the desktop so that it can be applied to other data in the future?

Best Answer

Simply save it in a .mat file:
save('nameOfFile.mat','nameOfVariable')
and then load it back into memory:
S = load('nameOfFile.mat');
mask = S.nameOfVariable;
Use the relevant absolute/relative path to save it on the desktop.