undefined function or method of type char
Show older comments
below is the link to my question. It is the first one listed on the homework in regards to image processing. Below it what I have started to but I keep getting an undefined function or method error of type char, any help or advice would be great!
funnyflag_2
for i = 1,32;
for j = 1,22;
r(i,j) = 1;
g(i,j) = 0;
b(i,j) = 0;
end
end
for i = 1,32;
for j = 23,46;
r(i,j) = 0;
g(i,j) = 1;
b(i,j) = 0;
end
end
for i = 1,32;
for j = 47,66;
r(i,j) = 0;
g(i,j) = 0;
b(i,j) = 0;
end
end
for i = 33,64;
for j = 1,22;
r(i,j) = 0;
g(i,j) = 1;
b(i,j) = 0;
end
end
for i = 33,64;
for j = 23,46;
r(i,j) = 0.5;
g(i,j) = 0.5;
b(i,j) = 0.5;
end
end
for i = 33,64;
for j = 47,66;
r(i,j) = 0;
g(i,j) = 0;
b(i,j) = 1;
end
end
r = c(:,:,1);
g = c(:,:,2);
b = c(:,:,3);
c = cat(3,r,g,b);
colormap(c);
image(myimage)
Accepted Answer
More Answers (3)
Sean de Wolski
on 29 Feb 2012
instead of 1,32 or 33,64, the comma (',') should be a colon (':');
doc colon
for more info
Walter Roberson
on 29 Feb 2012
for i = 1,32;
is not the correct way to write a "for" loop over a range of values.
You do not indicate which line is complaining about undefined function or variable ?
Walter Roberson
on 29 Feb 2012
0 votes
A colormap is not a 3D array: it is an N x 3 array, where N is the number of entries in the color map. For example, 256 x 3. The first column is red values, the second column is green values, the third column is blue values.
Remember, colormaps are row indexed by color numbers to determine the color to associate with a point for a pseudo-color plot. A pseudo-color plot has a single number for each point that is used for that row index, not a pair of numbers used for x-y indices.
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!