How save the image using strcat ?

조회 수: 4 (최근 30일)
Oman Wisni
Oman Wisni 2019년 1월 20일
편집: Oman Wisni 2019년 1월 20일
Hi, I want save my Image in folder there is include the name of image using strcat, I try but error ?
here my function :
function out = uji(fname)
im=imread(fname);
outdir = 'Image Result';
mkdir(outdir);
imwrite (strcat(fname(im(outdir, '1_ori.bmp'))));
out = im;
Could help me please ? thank you
  댓글 수: 2
Stephen23
Stephen23 2019년 1월 20일
This does not make much sense:
im(outdir, '1_ori.bmp')
If im is an image array, why are you trying to index into it using two chracter vectors?
fname(im(outdir, '1_ori.bmp'))
If fname is a character vector or a string, why are you trying to indexing into it using an image array?
strcat(fname(im(outdir, '1_ori.bmp')))
What are you concatenating together? (There is only one input argument, so you concatenate one thing ... with nothing else).
Oman Wisni
Oman Wisni 2019년 1월 20일
I just want to create the result save on the folder name Image Result with name of image..
So how I fixed it?

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

채택된 답변

madhan ravi
madhan ravi 2019년 1월 20일
doc sprintf
  댓글 수: 3
Guillaume
Guillaume 2019년 1월 20일
Do not use strcat to build paths. Always use fullfile that is guaranteed to use the correct path separator regardless of which OS you use.
Oman Wisni
Oman Wisni 2019년 1월 20일
편집: Oman Wisni 2019년 1월 20일
Yes sir. Thank you for all the answer. I get what I want.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by