Returning even column and row in a matrix

1 次查看(过去 30 天)
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 个评论
Adam
Adam 2020-2-25
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.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Environment and Settings 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by