Match two rows value by a column value
古いコメントを表示
Hi guys,
In a table I want to count all matching rows based of a value of a columns
If two rows have value '1' in column 34 and in column 9 have value 'Corn' set a count in an edit text
If two rows have value '2' in column 34 and in column 9 have value 'Corn' set another count in an edit text
and so on..
new_data=get(handles.uitable4,'Data');
index1= strcmp(new_data(:,34),'1', new_data(:,9),'Corn');
index2= strcmp(new_data(:,34),'2', new_data(:,9),'Corn');
count_total_corn = count(index1, index2);
set(handles.edit4,'string', count_total_corn)
index3= strcmp(new_data(:,34),'3', new_data(:,9),'Rice');
index4= strcmp(new_data(:,34),'4', new_data(:,9),'Rice');
count_total_rice = count(index3, index4);
set(handles.edit5,'string', count_total_rice)
Could you give me an ideea? The above doesn't work...thanks
1 件のコメント
Jan
2022 年 6 月 1 日
"Doesn't work" is a lean description. Prefer to share the details of the problem, if you want others to solve it. Do you get an error message?
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Historical Contests についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!