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

3 ビュー (過去 30 日間)
Asim Ismail
Asim Ismail 2017 年 9 月 8 日
回答済み: Jose Marques 2017 年 9 月 9 日
In a structure there is a column having characters of (LB, LL). How can I find how many LB and LL are there?
  8 件のコメント
KSSV
KSSV 2017 年 9 月 8 日
what is class of S.Type?
Asim Ismail
Asim Ismail 2017 年 9 月 8 日
編集済み: Asim Ismail 2017 年 9 月 8 日
char

サインインしてコメントする。

採用された回答

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 Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by