From a75e5d5d29ad0825896fd3dd0a754d72aeac0255 Mon Sep 17 00:00:00 2001 From: Olivier Sauter <olivier.sauter@epfl.ch> Date: Sun, 3 Mar 2024 10:27:16 +0100 Subject: [PATCH] fix case expression is cell array --- matlab/TCV/gdat_tcv.m | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/matlab/TCV/gdat_tcv.m b/matlab/TCV/gdat_tcv.m index 5a143d72..64585820 100644 --- a/matlab/TCV/gdat_tcv.m +++ b/matlab/TCV/gdat_tcv.m @@ -299,16 +299,23 @@ if isfield(gdat_data.gdat_params,'liuqe') && ~isempty(gdat_data.gdat_params.liuq liuqe_version = gdat_data.gdat_params.liuqe; else % if no specific liuqe requested in the parameter option, but specified e.g. in tcv_eq, use that one otherwise default - if any(regexpi(mapping_for_tcv.expression,'fbte','once')) - liuqe_version = -1 + if ~iscell(mapping_for_tcv.expression) + bb{1} = mapping_for_tcv.expression; else - ij = regexpi(mapping_for_tcv.expression,'LIUQE\.M.?','once'); - if ~isempty(ij) && any(regexpi(mapping_for_tcv.expression,'LIUQE\.M[2,3]','once')) - liuqe_version = str2num(mapping_for_tcv.expression(ij+7)) - end - ij = regexpi(mapping_for_tcv.expression,'LIUQE[^\.]','once'); - if ~isempty(ij) && any(regexpi(mapping_for_tcv.expression,'LIUQE[2,3]','once')) - liuqe_version = str2num(mapping_for_tcv.expression(ij+5)) + bb = mapping_for_tcv.expression; + end + for i=1:numel(bb) + if any(regexpi(bb{i},'fbte','once')) + liuqe_version = -1 + else + ij = regexpi(bb{i},'LIUQE\.M.?','once'); + if ~isempty(ij) && any(regexpi(bb{i},'LIUQE\.M[2,3]','once')) + liuqe_version = str2num(bb{i}(ij+7)) + end + ij = regexpi(bb{i},'LIUQE[^\.]','once'); + if ~isempty(ij) && any(regexpi(bb{i},'LIUQE[2,3]','once')) + liuqe_version = str2num(bb{i}(ij+5)) + end end end end -- GitLab