Print condition

clc;clear;close all;

%Pass condition here
str = 'result==0 && prc_dg[0]<prc_dg[1]';

id = ismember(str,' ');
str(id) = [];
ns = regexp(str,'&&','split');
L = length(ns);
shw = 'PrintFormat("';
for m=1:L
    shw = [shw ' %d,'];
end
shw(end) = [];
shw = [shw '",'];
for m=1:L
    shw = [shw ns{m} ','];
end
shw(end) = [];
shw = [shw ');'];
disp(shw);

ความเห็น