extracting values from a matrix

1 回表示 (過去 30 日間)
Michael Lowman
Michael Lowman 2021 年 10 月 20 日
回答済み: Voss 2021 年 10 月 20 日
Hey,
I have a matrix for my latin squared design which randomised my conditions across my sentence stimuli. Is it possible to extract specific values from a matrix and sort them into groups?
E.g. I want to extract from my matrix the values 1, 2 and 3 and group them into an array called block 1
(then the same again for the values 4, 5, and 6 and group those into block 2
Thanks!!
  1 件のコメント
Scott MacKenzie
Scott MacKenzie 2021 年 10 月 20 日
It's not clear what you are trying to do. Try providing more detail, such as an example of the matrix and an example of the arrays (block1, block2) you are trying create from the matrix.

サインインしてコメントする。

回答 (1 件)

Voss
Voss 2021 年 10 月 20 日
If M is your matrix, then block1 below will be a vector with all elements of M with value equal to 1, 2 or 3, in the order they are in M
block1 = M(M >= 1 & M <= 3);

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by