Help in troubleshooting a code
1 次查看(过去 30 天)
显示 更早的评论
f=imread('Image.jpeg');
red=f(:,:,1);
[r,c]=size(red)
z=zeros(r,c);
for i=1:r
for j=1:c
z(i,j)=dec2hex(red(i,j))
end
end
This code gives me an error 'Subscripted assignment dimension mismatch.' in line 7. I can't figure out why?
0 个评论
采纳的回答
Alexandra Harkai
2017-3-3
dec2hec results in a char array of 1*n for each (i,j) pair, which then would not fit into one element of the numeric array z.
Depends on what you want to use z for, you could consider changing the shape.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Other Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!