change columns in array to zeros and assign to another vector

1 回表示 (過去 30 日間)
Oday Shahadh
Oday Shahadh 2020 年 6 月 20 日
コメント済み: KSSV 2020 年 6 月 20 日
hi
I have a (n,3) array, I need to make the first and second coulmns zeros, and assign the resulted array to a new one
g=(a{1}(:,[1 2])==0);
tried this but not work

採用された回答

KSSV
KSSV 2020 年 6 月 20 日
n = 10 ;
A = rand(n,3) ; % matrix for demo
A(:,1:2) = 0 ; % make first two columns zero
B = A ; % assign tp B
  3 件のコメント
Oday Shahadh
Oday Shahadh 2020 年 6 月 20 日
v=cell(numel(a),1);
for i = 1:numel(a);
a{i}(:,1:2)=0;
v(i)=a{i};
end
not work
KSSV
KSSV 2020 年 6 月 20 日
b = a ;
for i = 1:numel(a)
b{i}(:,1:2) = 0 ;
end

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by