why it does not work ?

function out = block3(row, colomn)
a = zeros(row, colomn);
for i = 1:row
for j = 1:colomn
if ~mod(i,2) && ~mod(j,2)
a(i, j) = 1;
end
end

1 comentario

Voss
Voss el 29 de Oct. de 2023
You ask why it does not work. In order to answer that question, we need to know what it should do, but you haven't told us that. What should this function do?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 29 de Oct. de 2023

0 votos

  • missing end statement
  • no assignment to the output variable out

3 comentarios

EZRA
EZRA el 29 de Oct. de 2023
ok that is right thank you. but even if i do not assign the out put does it can be problom to me becaues until it is empty it does not matter. right.
EZRA
EZRA el 29 de Oct. de 2023
function block3(row, colomn)
a = zeros(row, colomn);
for i = 1:row
for j = 1:colomn
if ~mod(i,2) && ~mod(j,2)
a(i, j) = 1;
end
end
end
Voss
Voss el 29 de Oct. de 2023
Wild guess: Perhaps the function should output the variable 'a'.

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 29 de Oct. de 2023

Comentada:

el 29 de Oct. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by