change columns in array to zeros and assign to another vector

1 vue (au cours des 30 derniers jours)
Oday Shahadh
Oday Shahadh le 20 Juin 2020
Commenté : KSSV le 20 Juin 2020
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

Réponse acceptée

KSSV
KSSV le 20 Juin 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 commentaires
Oday Shahadh
Oday Shahadh le 20 Juin 2020
v=cell(numel(a),1);
for i = 1:numel(a);
a{i}(:,1:2)=0;
v(i)=a{i};
end
not work
KSSV
KSSV le 20 Juin 2020
b = a ;
for i = 1:numel(a)
b{i}(:,1:2) = 0 ;
end

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by