what changes can be done in the code
1 回表示 (過去 30 日間)
古いコメントを表示
i have to return values of diff between drug and placebo for given exel either for systolic or diastolic
function [diffdrug,diffplacebo] = xls_clinicaltrialbp(filename, bptype)
%by Manav Divekar, 2021-12-07
if ~exist('bptype','var')
bptype = 'Systolic';
end
treatment = readtable(filename,'sheet','Sheet1');
drugs = 0;
beforedia = 0;
beforesys = 0;
afteredia = 0;
aftersys = 0;
d = strcmpi(treatment.Properties.VariableNames,'Treatment');
drugs = treatment{:,d};
bd = strcmpi(treatment.Properties.VariableNames,'DiastolicBefore');
ad = strcmpi(treatment.Properties.VariableNames,'DiastolicAfter');
bs = strcmpi(treatment.Properties.VariableNames,'SystolicBefore');
as = strcmpi(treatment.Properties.VariableNames,'SystolicAfter');
beforedia = treatment{:,bd};
beforesys = treatment{:,bs};
afteredia = treatment{:,ad};
aftersys = treatment{:,as};
beforediap = beforedia(strcmpi(drugs,'Placebo'));
beforesysp = beforesys(strcmpi(drugs,'Placebo'));
afterediap = afteredia(strcmpi(drugs,'Placebo'));
aftersysp = aftersys(strcmpi(drugs,'Placebo'));
beforediad = beforedia(strcmpi(drugs,'drugs'));
beforesysd = beforesys(strcmpi(drugs,'drugs'));
afterediad = afteredia(strcmpi(drugs,'drugs'));
aftersysd = aftersys(strcmpi(drugs,'drugs'));
if (bptype == 'systolic')
diffdrug = beforesysd - aftersysd;
diffplacebo = beforesysp - aftersysp;
end
if (bptype == 'diastolic')
diffdrug = beforediad - afterdiad;
diffplacebo = beforediap - afterdiap;
end
Input :
[diffdrug,diffplacebo] = xls_clinicaltrialbp('clinicaltrialbp.xlsx')
or
[diffdrug,diffplacebo] = xls_clinicaltrialbp('clinicaltrialbp.xlsx','DIAStolic')
0 件のコメント
回答 (1 件)
Image Analyst
2021 年 12 月 11 日
You need to use contains:
if contains(bptype, 'sys', 'IgnoreCase', true)
diffdrug = beforesysd - aftersysd;
diffplacebo = beforesysp - aftersysp;
end
if contains(bptype, 'dia', 'IgnoreCase', true)
diffdrug = beforediad - afterdiad;
diffplacebo = beforediap - afterdiap;
end
参考
カテゴリ
Help Center および File Exchange で Biotech and Pharmaceutical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!