What can I use for equality test between input arguments of type cell?

2 ビュー (過去 30 日間)
Yasmin Tamimi
Yasmin Tamimi 2012 年 12 月 3 日
Hey all,
I have to check whether the data I have exists in an excel file or nor and if so I shall copy that row to a new excel file. all my data is of type cell. Here is my code:
[num, txt, raw] = xlsread('ExcelMainExport_ALL.xls'); Patient_ID = txt([2:end],1);
%% Search for Normal
for i = 1:length(Normal)
for j = 1:length(Patient_ID)
if Normal(i) == Patient_ID (j)
[num1,txt1]=xlsread('ExcelMainExport_ALL.xls',1,sprintf('A%d:IP%d',j));
xlswrite('Data_Collected_Normal.xls', txt1)
warning off MATLAB:xlswrite:AddSheet
end
end
end
where Normal is a 1X70 cell. And my error is in the equality test! Any help!!

採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 12 月 3 日
編集済み: Andrei Bobrov 2012 年 12 月 3 日
use
if strcmp(Normal{i},Patient_ID{j})
try variant of solution
[num, txt] = xlsread('ExcelMainExport_ALL.xls');
ii = ismember(txt1(2:end,1),Normal);
out = txt([false; ii],:);
xlswrite('Data_Collected_Normal.xls', out);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by