フィルターのクリア

Find all rows that contain a specific value in a excel

3 ビュー (過去 30 日間)
Cristian Martin
Cristian Martin 2022 年 5 月 28 日
コメント済み: Voss 2022 年 5 月 28 日
I vave an edit text an a push button for search all rows that contain a specific value in a column
T = readtable('prices.xlsx');
item = get(handles.edit1,'String');
FinalTable = T(strcmp(T.Product, 'String', item),:);
Where is my mistake?
Error using strcmp
Too many input arguments.
If instead of using get from edit1 and use:
T = readtable('prices.xlsx');
%item = get(handles.edit1,'String');
FinalTable = T(strcmp(T.Product, 'Corn'),:);
is working

採用された回答

Voss
Voss 2022 年 5 月 28 日
This call to strcmp:
strcmp(T.Product, 'String', item)
has an extraneous 2nd argument 'String'. It should be:
strcmp(T.Product, item)
This way, you'll notice, it conforms to the code that works, with 'Corn' being replaced by item.
  2 件のコメント
Cristian Martin
Cristian Martin 2022 年 5 月 28 日
Fantastic, thanks !
Voss
Voss 2022 年 5 月 28 日
You're welcome!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCell Arrays についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by