select only rows and not columns

6 ビュー (過去 30 日間)
andrea vivas
andrea vivas 2021 年 4 月 22 日
回答済み: Walter Roberson 2025 年 1 月 28 日
Does anybody knows how to select only rows and not columns? I'm trying to select all the first values of each column, is that possible?

回答 (2 件)

Rushil
Rushil 2025 年 1 月 28 日
Hi Andrea
From the attached image, it seems that you are running the following piece of code:
March_01_2021 = MarchVacc(:,2:51)
What this code does, is select all rows, and all columns with indices from 2 to 51. Thus, the output is a table of size 24 x 50 (since the number of rows in the table may be 24). In order to select a specific row to view, you may pass the index of that row as an input. Here is a snippet that does that:
idx = 1; % the row number to be viewed
March_01_2021 = MarchVacc(idx,:) % second input is ':' to allow viewing all columns of that row
More details about indexing into tables can be found at the link below:
Hope it helped you out.
larush

Walter Roberson
Walter Roberson 2025 年 1 月 28 日
March_01_2021 = MarchVacc(1,2:51)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by