フィルターのクリア

Need all row data after strcmp

3 ビュー (過去 30 日間)
Santosh Biradar
Santosh Biradar 2022 年 7 月 22 日
コメント済み: Jan 2022 年 7 月 23 日
try
in = 'AAA';
p = strcmp(in,raw);
if p >= 0
xlswrite('SummaryResult.xlsx',raw1(p),'AAA','A2')
else
0;
end
end
Once I will compare
I want all the row data where AAA is presnt in those column.
Please let me know for brief.
  5 件のコメント
Santosh Biradar
Santosh Biradar 2022 年 7 月 23 日
Hello @Jan
Here is 1st approach code 1: %%Here I want to find out 'aaa' from sheet->'MissingData', & later list out all Row data present on aaa column new sheet in same excel. This is done with writetable and readtable.
idx = ismember(tOld, tNew, 'rows'); %excels compared
writetable(tOld(~idx,:), 'SummaryResult.xlsx', 'Sheet', 'MissingData','Range','A2') %new sheet prepared with missing data
%%for finding 'aaa' i prepared dummy excel and compared with MissingData sheet
name = {'aaa'};
T = table(name);
writetable(T,'DummyTable.xlsx','sheet','temp');
B = readtable('DummyTable.xlsx','sheet','temp');
B = B(1:end,1:1);
A1 = readtable('SummaryResult.xlsx','sheet','MissingData'); %excels compared
A = A1(1:end,1:1);
idx = ismember(A, B, 'rows');
writeable(A(~idx,:),'SummaryResult.xlsx', 'Sheet', '724_MapDiff','Range','A2')
Second approach Code: Here the purpose is same but i used strcmp.
idx = ismember(tOld, tNew, 'rows'); %excels compared
writetable(tOld(~idx,:), 'SummaryResult.xlsx', 'Sheet', 'MissingData','Range','A2') %new sheet prepared with missing data
[num,txt,raw] = xlsread('SummaryResult.xlsx','NewlyAddedData');
in = 'aaa';
p = strcmp(in,raw(:,1)); % as 'aaa' is present in A column so.
if (p(:))
xlswrite('SummaryResult.xlsx',raw(p),'aaa','A2')
else
%do nothing
end
Please let me know for brief. I also have attached expected SummaryResult.xlsx. Pls look sheet3 and Sheet4.
Thank you
Jan
Jan 2022 年 7 月 23 日
I asked you, what the purpose of "if p >= 0" is. You did not answer this, but post the new line: "if (p(:))". Agaion the purpose is unclear. Do you mean:
if any(p(:))
Do you see, that your can format code in the forum? Please use the corresponding tools.

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

回答 (0 件)

カテゴリ

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

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by