Help in troubleshooting a code

1 回表示 (過去 30 日間)
fiona rozario
fiona rozario 2017 年 3 月 3 日
コメント済み: fiona rozario 2017 年 3 月 3 日
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?

採用された回答

Alexandra Harkai
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.
  1 件のコメント
fiona rozario
fiona rozario 2017 年 3 月 3 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNaNs についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by