What does 'Undefined operator '*' for input arguments of type 'table'' mean?
이전 댓글 표시
I have defined all the values to the following equation
ViNew(t,k) = (alpha)*(ViOld)*(t - 1)+(1 - alpha)*Qi(t)
and have asked Matlab to solve it as part of a function for loop. I have defined k as 1:length(1:80), which is the length of the excel sheet where I want my answers placed. Every part of the function is running except for the equation. It says that there is an
Undefined operator '*' for input arguments of type 'table''
I have no idea what that means and how I can fix it. Any guesses?
댓글 수: 1
Adam
2016년 3월 13일
It means you are trying to multiply a table object by something and table object does not have a '*' multiplication operator defined. Can't really say more than that as you haven't shown any code. I don't use tables, but usually you would have to use some method to operate on each value of a column or row of a table rather than trying to just multiply the table object itself.
답변 (1개)
Walter Roberson
2016년 3월 13일
1 개 추천
I suspect you are using readtable() to read a .xls or .xlsx file, thinking that it will return a numeric vector . It will not do so: readtable() returns object-oriented objects of type "table". You cannot multiply a "table" by something.
If this is what is happening, you can either use xlsread() to read into numeric array, or you can use the table indexing operators to extract numeric values from the table; see http://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-table.html
댓글 수: 2
Isabel Rojas-Ferrer
2016년 3월 13일
편집: Walter Roberson
2016년 3월 13일
Walter Roberson
2016년 3월 13일
Show us
class(data)
class(alpha)
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!