На основании этого вопроса Добавить изображение в отчет PDF , мне было интересно, можно ли сделать снимок осей в конструкторе приложений, чтобы сохранить их в отчете PDF?
Я пробовал приведенный ниже код, но получаю сообщение об ошибке
Ошибка:
Undefined function 'getSnapshotImage' for input arguments of type 'matlab.ui.control.UIAxes'.
Код:
function ButtonPushed(app, event)
import mlreportgen.dom.*;
import mlreportgen.report.*
folder = 'E:/';
file = 'shapes2.png'
fullFileName = fullfile(folder, file);
I= imread(fullFileName);
level = graythresh(I);
BW = imbinarize(I,level);
imshow( BW ,'Parent', app.UIAxes)
filter = {'*.pdf'};
[file, pathPDF] = uiputfile([folder,filter{1}])
if file ~= 0
d = Document('myPDF','pdf');
d.OutputPath = [pathPDF,file];
figure = app.UIAxes;
snap = Image(getSnapshotImage(app.UIAxes,d));
img1 = Image(fullFileName);
img1.Style = [img1.Style {ScaleToFit}];
close(d);
end
end