Effacer les filtres
Effacer les filtres

From a structure find the number of rows with a certain character

4 vues (au cours des 30 derniers jours)
In a structure there is a column having characters of (LB, LL). How can I find how many LB and LL are there?
  8 commentaires
KSSV
KSSV le 8 Sep 2017
what is class of S.Type?
Asim Ismail
Asim Ismail le 8 Sep 2017
Modifié(e) : Asim Ismail le 8 Sep 2017
char

Connectez-vous pour commenter.

Réponse acceptée

Jose Marques
Jose Marques le 9 Sep 2017
Hello Asim Ismail! Maybe this can be helpfull:
I create a struct "s" with a field "type".
clear all;
close all;
clc;
A = ['LB';'LB';'LL';'LB';'LL'];
field = 'type';
value = A;
s = struct(field,value);
LB_quant = sum(s.type(:,2)=='B') %number of 'LB' in array type of struct s
LL_quant = sum(s.type(:,2)=='L') %number of 'LL' in array type of struct s

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by