What does "something = cell (size(session,1),1" mean/look like?
2 次查看(过去 30 天)
显示 更早的评论
I know the "cell" function creates an array of empty cells and I know that I didn't specify what "session" looks like. But given a matrix for session, what would the above look like? Thanks.
1 个评论
回答(2 个)
John D'Errico
2017-2-1
Why not think about it? Look at the inside.
What does this:
size(session,1)
do? If you have no clue, then READ THE HELP for size. Suppose you broke it into two pieces:
K = size(session,1);
something = cell(K,1);
This is essentially identical to the fragment that you show, in terms of what it will do, except that it also creates a spurious variable called K. But that is not really relevant. If you know what size does, AND you understand what the cell function does, then what does it tell you?
When you see a problem too difficult for you to understand, break it down into pieces.
0 个评论
David J. Mack
2017-2-1
Hey Marie,
the above creates a column cell with n elements, where n are the number of rows of session.
Cheers, David
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!