Hi, This is my code.[fname path]=uige​tfile('.jp​g','open a image as input for trining'); fname=strc​at(path,fn​ame); im=imread(fname); imshow(im); title('Input Image'); c=input('Enter the Class (Numbers from 1-10)'); %%Feature extraction F=FeatureStatis

2 次查看(过去 30 天)
c=input('Enter the Class (Numbers from 1-10)') in here I want to put the image class in string characters. how can I do it insted of numbers.

采纳的回答

Image Analyst
Image Analyst 2018-9-16
To get your number as a string instead of a double, use the 's' option:
classNumber = input('Enter the class number : ','s')
  2 个评论
Samadhi Hirimuthugoda
编辑:Image Analyst 2018-9-16
Thank you very much. This is my first math lab program. When I move to the testing step I got an error.
"Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters."
My code is this.
[fname path]=uigetfile('.jpg','Provide a Image for Testing');
fname=strcat(path,fname);
im=imread(fname);
imshow(im);
title('Test Image');
%%Find out which class it belongs
Ftest=FeatureStatistical(im);
%%Compare with database
load db.mat
Ftrain=db(:,1,2);
Ctrain=db(:,3);
for{1=1:size{Ftrain,1}}
dist{1,:}=aum(aba{Ftrain{1,:}-Ftest});
end
m=find(dist==min(dist),1);
det_class=Ctrain(m);
msgbox(strcat('detected class=',num2str(det_class)));
And the error gives for this.
for{1=1:size{Ftrain,1}}
If you can please help me
Image Analyst
Image Analyst 2018-9-16
Don't use braces. Try this:
for k = 1 : size(Ftrain,1)
dist{1,:} = aum(aba(Ftrain{1,:}-Ftest));
end
but I'm not sure what your variables are. Use braces only with cell arrays and tables. See the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by