필터 지우기
필터 지우기

how to use imwrite in matlab?

조회 수: 13 (최근 30일)
Anushka
Anushka 2015년 6월 17일
답변: kass 2020년 1월 29일
how to use imwrite in matlab?The file which that we are specifying to write,should it be already be created in the folder?

답변 (4개)

Walter Roberson
Walter Roberson 2015년 6월 17일
No. If the file does not already exist then it will be created. If the file does already exist then it will be overwritten.
  댓글 수: 4
Abdoo
Abdoo 2015년 6월 18일
편집: Abdoo 2015년 6월 18일
Notice, Check the file is close before you go on, because can't write data and file is open.
Guillaume
Guillaume 2015년 6월 18일
Note: to close all open file handles:
fclose all

댓글을 달려면 로그인하십시오.


B.k Sumedha
B.k Sumedha 2015년 6월 17일
편집: B.k Sumedha 2015년 6월 17일
imwrite(A,filename,fmt);
This is the general format of imwrite. Its not necessary that image needs to be present in ur folder. Where A is ur image which u want to save,specify the file name and its format. For ex:
imwrite(im_DIF,'Image difference.bmp','bmp');
  댓글 수: 4
mima  zebouchi
mima zebouchi 2016년 4월 18일
but what about imrwite of dicom images plz i need answer
Walter Roberson
Walter Roberson 2016년 4월 18일
You cannot use imwrite() to write dicom images. You need dicomwrite()

댓글을 달려면 로그인하십시오.


Alejandro Cruz Rubio
Alejandro Cruz Rubio 2019년 6월 1일
Anyone Know how to save a block of images with imwrite?
  댓글 수: 8
Alejandro Cruz Rubio
Alejandro Cruz Rubio 2019년 6월 3일
편집: Rik 2019년 6월 3일
My version of Matlab is 2018b. Yeah I solve the problem with K and k and I get the same error. And if I use the arrayCells inside of for, that is:
for k=1:numel(arrayCells)
filename = sprintf('Output_block_%d.png', K);
imwrite(arrayCells{k}, filename);
end
I get this error: "Error using imwrite (line 433)
Unable to determine the file format from the file name" because I use arrayCells but if I use "block" I don´t have any problem but I don´t get my goal
Rik
Rik 2019년 6월 3일
With the code you show you actually haven't fixed the code yet. The code below should work a lot better.
for k=1:numel(arrayCells)
filename = sprintf('Output_block_%d.png', k);%<--- lower case k, instead of upper case K
imwrite(arrayCells{k}, filename);
end

댓글을 달려면 로그인하십시오.


kass
kass 2020년 1월 29일
for k=1:numel(I)
imwrite(I{k}, ['filename' num2str(k) '.pgm']);
end
%I is arraycells

카테고리

Help CenterFile Exchange에서 Import, Export, and Conversion에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by