How to create a function that will call a text value to open a file?

I am creating a function that needs to have a couple of values associated with a file that it loads and does some processing to. The function looks like this (obviously names changed.)
function [outx,outy] = imstupid(image_filename,var1,var2,var3)
G = imread('filename','bmp');
.Functions
.That
.Already
.Work
end
Sorry if this isn't clear, but basically I need to have image_filename be called as text value that is used in the imread function. Thanks!

 채택된 답변

Vishal Rane
Vishal Rane 2014년 6월 12일
Assuming image_filename contains the complete path (if not on matlab path) or name of image to be read, then
G = imread( image_filename);

댓글 수: 1

Just a minor note, when inputting the image_filename variable, one needs to make sure to include the format as 'image_filename.format' syntax or else there will be errors.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

제품

질문:

2014년 6월 12일

댓글:

2014년 6월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by