change columns in array to zeros and assign to another vector

1 visualización (últimos 30 días)
Oday Shahadh
Oday Shahadh el 20 de Jun. de 2020
Comentada: KSSV el 20 de Jun. de 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

Respuesta aceptada

KSSV
KSSV el 20 de Jun. de 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 comentarios
Oday Shahadh
Oday Shahadh el 20 de Jun. de 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 el 20 de Jun. de 2020
b = a ;
for i = 1:numel(a)
b{i}(:,1:2) = 0 ;
end

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by