Question about extracting rows from a table based on string

1 vue (au cours des 30 derniers jours)
BN
BN le 7 Août 2020
Modifié(e) : dpb le 9 Août 2020
Hello everyone
I wanted to store all winter ("Win") values of the rrr24 column in my data set in a new array
So I tried to do it like:
C_Winter = temp(strcmp((temp.seasons,'Win'),rrr24));
But this error appears,
C_Winter = temp(strcmp((temp.seasons,'Win'),rrr24));
Error: Invalid expression. When calling a function or indexing a variable,
use parentheses. Otherwise, check for mismatched delimiters.
I tried some other ways but all of them leads to error. Do you know what should I do?
Thank you.
  5 commentaires
dpb
dpb le 7 Août 2020
Modifié(e) : dpb le 9 Août 2020
The above is all columns, you said you wanted the one variable...alternatively, remove the string from the 'seasons' variable...
temp.seasons=categorical(temp.seasons); % convert to categorical variable type
C_Winter=temp.rrr24(temp.seasons=='Win'); % pick winter seasons from rrr24 array
BN
BN le 9 Août 2020
Thank you

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by