Masking an array back to a selected region in a Matrix

1 回表示 (過去 30 日間)
waqas
waqas 2019 年 9 月 23 日
コメント済み: waqas 2019 年 9 月 23 日
Hi,
I have a column vector which I need to insert back to the a matrix(Attached in .mat file). The variable region has logicals in the places where I want to put the data given by variable name vdisp_selected. Is there an efficient way of achieving this by masking?
I tried to play around with masking based on region but I am getting a square region in the end.
Cheers,
  2 件のコメント
Fabio Freschi
Fabio Freschi 2019 年 9 月 23 日
region is 304x640 (double), vdisp_selected is 16472x1 (logical). How vdisp_selected is related to region?
waqas
waqas 2019 年 9 月 23 日
Hi,
Its the otherway around. 'region' is a 304x640 (logical) while vdisp_selected(16472x1) is a double. 'region' has (16742x1) ones and the locations where I have 1, I want to put the data of vdisp_selected.
I initially used the 'region' to extract data from another matrix and now want to insert updated data back to the same locations.

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

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 9 月 23 日
out = double(region);
out(region) = vdisp_selected;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by