Can use image name as an argument in an if else statement?
조회 수: 2 (최근 30일)
이전 댓글 표시
I am a beginner. I have a set of 4 images. The description of each of these images is in separate image files. So is there a way I can use the image names as arguments in an if condition ? For example :-
if selected image = "1.bmp"
Imshow (desc1.jpg)
Else if selected image = "2.bmp"
Imshow (desc2.jpg)
End
댓글 수: 0
답변 (1개)
ES
2017년 12월 8일
you have to use strcmp to compare strings. And use single quotes in strings.
if strcmp(selectedimage, '1.bmp')
imshow ('desc1.jpg')
elseif strcmp(selectedimage, '2.bmp')
imshow ('desc2.jpg')
End
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!