フィルターのクリア

find a word in a sentence in a cell

1 回表示 (過去 30 日間)
Amr Hashem
Amr Hashem 2015 年 5 月 10 日
コメント済み: Stephen23 2015 年 5 月 18 日
i want to search for all the rows (:,6)that contain a specific word
i try :
[num text alldata] = xlsread('result.xlsx','1'); % import excel file
j=1;
k=1;
for i=1:size(alldata,1)
d = regexp(alldata{i,6},'[ ]*','split') % this split sentences but didn't save
for L=1:length(d)
idx(k)=l;
k=k+1; end
if isequal (alldata{i,6},'battery') % search for word "battery"
defs(j)=i;
j=j+1;
end end
data=alldata(defs,:);
but it didn't work....!
SOS...any help please.

採用された回答

Star Strider
Star Strider 2015 年 5 月 10 日
I don’t have your data so I can’t run your code or test this, but see if:
if strcmpi(alldata{i,6},'battery') % search for word "battery"
improves your code.
It uses the strcmpi (case-insensitive string comparison) to do the test.
  2 件のコメント
Amr Hashem
Amr Hashem 2015 年 5 月 15 日
please could you help me in ... i have this two tables querymdr & idx2 :
i want to compare the fisrt two coulmns of them , and the multiple value copy column 6 of it only
i want to have the answer like this:
what i can do? any one has an idea?
Amr Hashem
Amr Hashem 2015 年 5 月 18 日
how i can use "strfind" instead of " strcmpi" and return 1 or 0

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by