Azzera filtri
Azzera filtri

Returning even column and row in a matrix

2 visualizzazioni (ultimi 30 giorni)
David
David il 25 Feb 2020
Commentato: Adam il 25 Feb 2020
Hi, I got a problem with some error with my home work. The requirement is created a function that can return the even column and even row.
Here is what i do
function even_index(M)
A=M(2:2:end,2:2:end)
end
how ever when i put to command window something like even_index([ 2 1 3 4; 3 2 2 1; 4 3 2 1; 7 8 5 6])
Matlab said: Error: File: even_index.m Line: 13 Column 77
Invalid experession
I saved the file into matlab already but I have the same problem with three function I created
Could someone help me explain it. Appreciate it
  1 Commento
Adam
Adam il 25 Feb 2020
Your function only has about 5 lines as you have shown it here so I don't know how it could error on Line 13 unless the function is bigger than you show.
What does
which even_index
point to? And when you open what it points to is it the function you expect it to be?
Also, if you select the 'Pause on errors' option from the Run dropdown menu in the editor before calling your code in the command window it will stop on the line that has the error.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Environment and Settings 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