Generate PDF image with 76cm x 240cm

1 回表示 (過去 30 日間)
Marko Jankovic
Marko Jankovic 2020 年 10 月 20 日
コメント済み: Marko Jankovic 2020 年 10 月 21 日
Hello!
I have specific problem. I have matrix 76x240 with binary value...
I need to generate large size image in pdf, jpg or png format (76cm x 240cm) from figure?
Any idea?
This is my simple code:
clear all
close all
a = 76;
b = 240;
x = randi([0 1],a,b);
imshow(x,'Border','tight','InitialMagnification',500);
hold on;
[rows, columns] = size(x);
for row = 1 : 1 : rows+1
line([1-0.5, columns-0.5], [row-0.5, row-0.5], 'Color', 'r');
end
for col = 1 : 1 : columns+1
line([col-0.5, col-0.5], [1-0.5, rows-0.5], 'Color', 'r');
end
for i=1:b
for g=1:a
if x(g,i)==0
plot(i,g,'g+','MarkerSize',12);
end
end
end
set(gcf, 'Position', get(0, 'ScreenSize'))

採用された回答

Spectro
Spectro 2020 年 10 月 20 日
編集済み: Spectro 2020 年 10 月 20 日
All you have to do is put this at the end of your code:
set(gcf, 'units', 'centimeters', 'PaperPosition', [0 0 240 76])
saveas(gcf, 'name_of_your_pic.png')
That should do the trick.
  1 件のコメント
Marko Jankovic
Marko Jankovic 2020 年 10 月 21 日
Thanks a lot!
and for PDF
set(gcf, 'units', 'centimeters', 'PaperPosition', [0 0 240 76]);
set(gcf, 'PaperUnits', 'centimeters', 'PaperSize',[240 76]);
print -dpdf -opengl name_of_your_pic

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by