Info

此问题已关闭。 请重新打开它进行编辑或回答。

i have created an array of color values of some images,how i insert the name of the images in the array

1 次查看(过去 30 天)
black = length(darks)/pixels;
white = length(lights)/pixels;
red = length(find((h >.9167 | h <=.083) & h~=-1))/pixels;
yellow=length(find(h >.083 & h<=.25))/pixels;
green=length(find(h > .25 & h<= .4167))/pixels;
cyan= length(find(h > .4167 & h<= .5833))/pixels;
blue=length(find(h > .5833 & h <= .75))/pixels;
magenta=length(find(h > .75 & h <= .9167))/pixels;
disp('Red=')
disp(red)
disp('Blue=')
disp(blue)
a(i,1)=red
a(i,2)=green
a(i,3)=blue
a(i,4)=yellow
a(i,5)=cyan
a(i,6)=magenta
a(i,7)=black
a(i,8)=white
end
dlmwrite('frs.mat',a)
b=dlmread('frs.mat')
  1 个评论
Geoff Hayes
Geoff Hayes 2014-6-15
编辑:Geoff Hayes 2014-6-15
Luna - it is not all that clear what you are asking, and the code above is unreadable and incomplete. Please edit your question, highlight the code and press the {}Code button. The alternative is to just attach your script or function m-file to your question.
And please clarify what you are asking - what are the image names? Are they the variables (red,hello,green,etc.) in the above code, or something else?

回答(1 个)

Image Analyst
Image Analyst 2014-6-20
To combine numbers and strings in the same variable, you'll have to use a cell array or a table. For more on cell arrays, see the FAQ: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

此问题已关闭。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by