Indexing/Accessing Entire Columns of Nested Array

3 ビュー (過去 30 日間)
Alyssa
Alyssa 2024 年 8 月 7 日
回答済み: Aditya 2024 年 8 月 7 日
I have a nested cell array {48x691}. I would like to isolate an entire column of the nested cell array while grabbing all of the rows such that I would get the nested arrays in this way:
{:,1} {:, 2} {:,3} ... {:,691}
In other words, how do I get all of the 691 columns from the nested array extracted such that I grab the 48 rows each time?
Thank you!

採用された回答

Aditya
Aditya 2024 年 8 月 7 日
Hi Alyssa,
You can refer to this documentation page to understand the array indexing in MATLAB: Array Indexing - MATLAB & Simulink - MathWorks India
If you want to get any particular column with all the rows, you can do it like this:
nestedArray = cell(48, 691);
% Access the second column
secondColumn = nestedArray(:, 2);
If you have any other query, let me know!

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by