MATLAB: Save Logical array as jpg

save as png

Hello guys
I got a smal Problem. I got a Logical array which i want to save as a jpg. But i have to convert it to a differend type of datatype. How i should convert it to save it? I want to use this:
imwrite(kl , [hg f1 '.jpg'],'jpg');
hg is the Path where i want to save it
f1 is the name of the new png
kl is the logical array
Thanks for your help 😀

Best Answer

If k1 is your logical..convert it to double
k1 = double(k1) ;