change columns in array to zeros and assign to another vector

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

KSSV
KSSV il 20 Giu 2020
n = 10 ;
A = rand(n,3) ; % matrix for demo
A(:,1:2) = 0 ; % make first two columns zero
B = A ; % assign tp B
  3 Commenti
Oday Shahadh
Oday Shahadh il 20 Giu 2020
v=cell(numel(a),1);
for i = 1:numel(a);
a{i}(:,1:2)=0;
v(i)=a{i};
end
not work

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by