error using ==> times
1 次查看(过去 30 天)
显示 更早的评论
what does it mean that error below. can anyone explain to me. i can not understand the error. thanks
??? Error using ==> times
Integers can only be combined with
integers of the same class, or
scalar doubles.
0 个评论
采纳的回答
James Tursa
2012-5-3
You can do this:
m = int32(1:3);
n = m .* 2; % integer class times scalar double
You can't do this:
m = int32(1:3);
n = m .* [4:6]; % integer class times same size double
So if you need to do the latter, you can do it like this:
m = int32(1:3);
n = m .* int32([4:6]); % integer class times same size same class
0 个评论
更多回答(1 个)
Junaid
2012-5-3
I think whatever vector you are trying to multiplying should have same class (data types). So first you type cast to one class.
like
x = double(x);
3 个评论
Junaid
2012-5-4
If your matrix dimension doesn't satisfy the condition of multiplication then you can't multiply them. You have check the Dimenions.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!