Returning even column and row in a matrix

1 回表示 (過去 30 日間)
David
David 2020 年 2 月 25 日
コメント済み: Adam 2020 年 2 月 25 日
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 Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by