2 dimensional array operation
2 views (last 30 days)
Show older comments
Index is 1000x400 logical. Current is 1000x400 double.
Array2D = Current(Index==0);
Why does Array2D have "399060x1 double" data? I expected to see 1000x400 double. How can I get "1000x400 double"?
3 Comments
Stephen23
on 14 Aug 2018
Edited: Stephen23
on 14 Aug 2018
"I expected to see 1000x400 double"
The MATLAB documentation describes how array indexing works, and states that when using a logical array like you are, the "output is always in the form of a column vector." This also makes sense, because if you extract some arbitrary number of elements from an array, a vector is the only shape that is guaranteed to be able to hold them.
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!