Hi,
I have a matrix of integer values and a coulm of decimal values, as follows
A = [2 3 7 6; 4 6 4 6; 5 1 3 3]; % a mXn matrix
B = (-0.7, -0.3. -0.1, 0, 0.1, 0.3, 0.7)' ; % a column of bX1 decimal values
Could you help me vectorise (speedup) the following operation of find AA, which is a matrix of decimal values of B.
for i=1:m
for j=1:n
AA(i,j) = B(A(i,j),1);
end
end
Thank you for your help.

1 件のコメント

madhan ravi
madhan ravi 2018 年 12 月 6 日
just give an example of your desired output

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

 採用された回答

Bruno Luong
Bruno Luong 2018 年 12 月 6 日

1 投票

AA = B(A)

1 件のコメント

Jayant Yadav
Jayant Yadav 2018 年 12 月 6 日
Thank you very much. how silly of me.

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

その他の回答 (0 件)

カテゴリ

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by