在Matlab中识别标志集并打印消息
嗨,我正在大循环中检查某些情况,在这个大循环中有以下语句:在Matlab中识别标志集并打印消息,matlab,Matlab,嗨,我正在大循环中检查某些情况,在这个大循环中有以下语句: %Center Dialouge timers_c = [start_dpc_sh_hi_timer_c, start_dpc_sh_lo_timer_c, start_ffm_sh_act_hi_timer_c,... start_ffm_sh_act_lo_timer_c, start_hpot_eff_loss_timer_c, start_lfpt_dpsh_timer_c,...
%Center Dialouge
timers_c = [start_dpc_sh_hi_timer_c, start_dpc_sh_lo_timer_c, start_ffm_sh_act_hi_timer_c,...
start_ffm_sh_act_lo_timer_c, start_hpot_eff_loss_timer_c, start_lfpt_dpsh_timer_c,...
start_pc_sh_time_c, start_post_tl_nl_c, start_pre_tl_nl_c, start_elec_lu_timer_c];
if perf_case_c ~= -1
for k = 1:10
if iscellstr(timers_c(k)) == 1
perf_case_timer_c = timers_c{k};
timer_set_c = 1;
end
end
end
要确定对话消息中要输出的开始时间和案例类型:
if timer_set_c == 1
pcase_c = msgbox([sprintf('%s'),perf_case_c,sprintf('\nMET:%s\n'),perf_case_timer_c],'PERFORMANCE CASE');
end
我无法获取确定哪种情况有效的if语句。我试图以某种方式使用从-1到字符串的更改,但它不太管用
一个最起码的例子是
%假设所有计时器初始化为零
%假设case~=-1(是一个字符数组,字符串
timers_c=[timer1,timer2,timer3]
if case ~= -1
for k = 1:3
if iscellstr(timer_c(k)) ==1
case_time = timers(c{k});
time_set_flag = 1
end
end
end
。。。
然后循环之外就是上面的msgbox您是否尝试逐行运行脚本或函数,以查看每个变量是否在范围内,以及它们是否具有正确的值?@m\u power是的,一切正常。我只是想不出一种方法来确定计时器数组的哪个值被设置为字符串。请提供一个最小值示例显示了您的问题。我没有时间破译所有变量名。您的msgbox行位于同一脚本或同一函数中吗?消息框位于循环之外,位于同一脚本中