Borrar filtros
Borrar filtros

forcing the final column in a matrix to be zero

1 visualización (últimos 30 días)
A Poyser
A Poyser el 31 de Mzo. de 2023
Comentada: A Poyser el 31 de Mzo. de 2023
I want to make the final column to go to zero once I go past a certain flag number
k = 10
a = zeros(1:k)
if b < 1
a = (end 0)
end
I think it looks something like this but I know it isn't exactly right
please help
Alex

Respuesta aceptada

VBBV
VBBV el 31 de Mzo. de 2023
Editada: VBBV el 31 de Mzo. de 2023
k = 10
k = 10
a = ones(3,k)
a = 3×10
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
b = -1;
if b < 1
a(:,end) = 0;
end
a
a = 3×10
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by