필터 지우기
필터 지우기

Matrix does not compile

조회 수: 4 (최근 30일)
Jon Camilleri
Jon Camilleri 2015년 11월 21일
댓글: Image Analyst 2015년 11월 21일
I am trying to create a bit string, however, this does not compile:
if ((iris_data{1,1} < mean(iris_data{1,1}) r={1,0,0,0};
Error: Unexpected MATLab expression
NOTE: Hitting enter does not appear to feed a carriage return to the forum.

채택된 답변

James Tursa
James Tursa 2015년 11월 21일
편집: James Tursa 2015년 11월 21일
Looks like you have unbalanced parentheses. E.g., this would fix that problem:
if iris_data{1,1} < mean(iris_data{1,1})
r={1,0,0,0};
end
BUT I have to question the logic in this. It looks like you may have a vector expression here:
iris_data{1,1} < mean(iris_data{1,1})
Which would mean the if-test is likely not doing what you really wanted. Can you explain in more detail what you want this if-test to do? What exactly is iris_data{1,1}, and what is r supposed to be?
  댓글 수: 2
Jon Camilleri
Jon Camilleri 2015년 11월 21일
You guessed right, the operation is not what I need.
I wanted to do a bitwise operation, which requires the FixedPoint Designer.
The data should represent statuses i.e. 1 = accepted because it is more than the mean 0 = not accepted because it is not more than the mean
iris_data is a 4x150 matrix represented by numerical data where measurements are taken from flowers.
I am just trying to come up with a machine learning algorithm.
Image Analyst
Image Analyst 2015년 11월 21일
Well when they're cells, we call it a "cell array" rather than a matrix, though actually it is a matrix composed of cells. Please, please, please read the FAQ on cells.
So, the upper left cell, iris_data{1,1} -- what is that? Is it a single scalar number? Or is it a vector or a whole matrix? And why are you using cells instead of a much, much simpler numerical array, which, by the way has far less overhead and takes up far less memory?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by