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

3 次查看(过去 30 天)
In a structure there is a column having characters of (LB, LL). How can I find how many LB and LL are there?
  8 个评论

请先登录,再进行评论。

采纳的回答

Jose Marques
Jose Marques 2017-9-9
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 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by