Save image using Guide GUI does not work
显示 更早的评论
When trying to save an image from my GUI I get the error:
-----------------------------------------------------------------------------
Error using imwrite (line 442)
Expected DATA to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64, logical
Instead its type was matlab.graphics.axis.Axes.
-------------------------------------------------------------------------------------------
I want to save an image that I modified, where I added squares and/or other images (see image). This is the code I am using:
first_c= 'C:\Users\';
user_name= getenv('username');
second_c='\Desktop';
com_path= fullfile(first_c,user_name,second_c);
a= handles.axes1;
defaultFileName = fullfile(com_path, '*.png*');
[baseFileName, folder] = uiputfile(defaultFileName, 'Specify a file');
if baseFileName == 0
% User clicked the Cancel button.
return;
end
fullFileName = fullfile(folder, baseFileName);
imwrite(a, fullFileName);
--------------------------------------------------------------------------------------
Can someone please help me? It is for an important project.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!