Specify folder for saving images in imwrite

조회 수: 9 (최근 30일)
Mohana Singh
Mohana Singh 2019년 4월 14일
답변: Walter Roberson 2019년 4월 14일
I need to save images in a loop and also need to assign specific names to them for which I was using the following, which worked fine :
imwrite(view,sprintf('view_%d_%d.png',i,j)); %where view is the image data to be stored
But I also need to save them in specific folders but positioning the folder pathname is giving errors.
imwrite(view,^,sprintf('view_%d_%d.png',i,j),^); %tried putting pathname at locations with ^
> Error: Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.
> Error in imwrite (line 418) [data, map, filename, format, paramPairs] = parse_inputs(varargin{:});
What would be the correct syntax?

채택된 답변

Walter Roberson
Walter Roberson 2019년 4월 14일
foldername = 'NameOfFolderGoesHere'
filename = fullfile(foldername, sprintf('view_%d_%d.png', i, j));
imwrite(view, filename);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by