From a structure find the number of rows with a certain character
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Asim Ismail
il 8 Set 2017
Risposto: Jose Marques
il 9 Set 2017
In a structure there is a column having characters of (LB, LL). How can I find how many LB and LL are there?
8 Commenti
Risposta accettata
Jose Marques
il 9 Set 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
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!