select, only once, the names present in a struct
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Alberto Acri
le 14 Juin 2023
Modifié(e) : Stephen23
le 14 Juin 2023
I have the following struct. Is it possible to select, only once, the names in the 'SeriesDescription' column? So I would need to create, in this case, a struct or table consisting only of: 'Scout', 'Serie', 'standard'.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1410774/image.png)
0 commentaires
Plus de réponses (1)
Les Beckham
le 14 Juin 2023
S.Number = compose('%04d', 0:16)'; % create test data since you only included a picture of your data
desc = {'Scout'; 'Scout'; 'Scout'};
for i = 4:13
desc{i} = 'Serie';
end
for i = 14:17
desc{i} = 'standard';
end
S.SeriesDescription = desc;
% Now, extract the unique elements of SeriesDescription and create a table
T = table(unique(S.SeriesDescription), 'VariableNames', {'SeriesDescription'})
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!