Borrar filtros
Borrar filtros

Skipping 1st two calculations of a loop

1 visualización (últimos 30 días)
Prakhar Modi
Prakhar Modi el 8 de Jul. de 2019
Editada: dpb el 8 de Jul. de 2019
hi everyone,
i need to write a code like
for i=1:n
for j=1:k
C(i,j)= a(i)+b(j)+c(j)
end
end
but here i have to provide a particular value of C(1,1) and C(1,2). So is there a way i can skip these two calculation and start with j=3. But do remember when i=2 I want that j should start from 1:k. Only C(1,1) and C(1,2) I have to skip.
Thanks in advance

Respuesta aceptada

dpb
dpb el 8 de Jul. de 2019
Editada: dpb el 8 de Jul. de 2019
for i=1:n
for j=1:k
C(i,j)= a(i)+b(j)+c(j)
end
end
C(1,1:2)=[C11 C12]; % fixup special cases
  2 comentarios
Prakhar Modi
Prakhar Modi el 8 de Jul. de 2019
thank you
dpb
dpb el 8 de Jul. de 2019
Sometimes the answer is too obvious... :)

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

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by