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
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!