Using If Statement on Table2Array

Hello, I'm fairly new to Matlab, and Im having trouble using an if statement on an array that I got from a table. My code looks something like this:
A = table2array(T)
M = movstd(A,18)
if M <10
binary = 1
else if std > 10
binary = 0
end
But, I'm getting no output. Any help would be great. If it's of any use, my T variable is imported data of a 14400x1 table.

답변 (1개)

Peter Perkins
Peter Perkins 2017년 6월 9일

0 개 추천

Not sure what the table looks like so this is at best a guess.
movstd returns a vector (or maybe a matrix). You're using a relational operator on that as the condition of your if. That's never what you want. Probably, you want something like
binary = (M < 10)
to return a vector of logicals.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2017년 6월 8일

답변:

2017년 6월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by