Azzera filtri
Azzera filtri

why it does not work ?

1 visualizzazione (ultimi 30 giorni)
EZRA
EZRA il 29 Ott 2023
Commentato: Voss il 29 Ott 2023
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 Commento
Voss
Voss il 29 Ott 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?

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 29 Ott 2023
  • missing end statement
  • no assignment to the output variable out
  3 Commenti
EZRA
EZRA il 29 Ott 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 il 29 Ott 2023
Wild guess: Perhaps the function should output the variable 'a'.

Accedi per commentare.

Categorie

Scopri di più su Language Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by