필터 지우기
필터 지우기

Returning even column and row in a matrix

조회 수: 2 (최근 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 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