I want to get the number of rows in doulble matrix but kept recieve an error
1 次查看(过去 30 天)
显示 更早的评论
I have varible W1 type double and size 20x5
I workspace the varible looks like
Name Value
W1 20x5
I can know the number of row by pressing length command but does not work with size command and shows an error any help please
With lenghth command
length(W1)
ans =
20
The tpye of the variable
class(W1)
ans =
double
But with size does not work
size(W1)
Subscript indices must either be real positive integers or logicals.
0 个评论
采纳的回答
Walter Roberson
2016-7-12
You assigned something to a variable named size, so you will not be able to call the size() function until the variable size goes out of scope.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!