undefined function or method of type char
显示 更早的评论
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)
采纳的回答
更多回答(3 个)
Sean de Wolski
2012-2-29
instead of 1,32 or 33,64, the comma (',') should be a colon (':');
doc colon
for more info
Walter Roberson
2012-2-29
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
2012-2-29
0 个投票
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.
类别
在 帮助中心 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!