From dce0967deb25c4eb00cb0ec0780f8cc9f242512c Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Thu, 30 Nov 2023 12:38:35 +0100 Subject: [PATCH] GSA: replace deprecated hist() syntax under MATLAB --- matlab/gsa/log_trans_.m | 6 +++++- matlab/gsa/redform_map.m | 12 ++++++++++-- matlab/plot_identification.m | 18 +++++++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/matlab/gsa/log_trans_.m b/matlab/gsa/log_trans_.m index 39b44ab250..05c8540955 100644 --- a/matlab/gsa/log_trans_.m +++ b/matlab/gsa/log_trans_.m @@ -38,7 +38,11 @@ if ~(max(y0)<0 | min(y0)>0) isig=-1; y0=-y0; end - n=hist(y0,10); + if isoctave + n=hist(y0,10); + else + n=histcounts(y0,10); + end if n(1)>20*n(end) try lam=fzero(f,[-min(y0)+10*eps -min(y0)+abs(median(y0))],[],y0); diff --git a/matlab/gsa/redform_map.m b/matlab/gsa/redform_map.m index d8681ce2da..5bd3c3667f 100644 --- a/matlab/gsa/redform_map.m +++ b/matlab/gsa/redform_map.m @@ -521,9 +521,17 @@ if iload==0 hh_fig=dyn_figure(options_.nodisplay,'name',options_map.figtitle); subplot(221) if ilog - hist(y1,30) + if isoctave + hist(y1,30) + else + histogram(y1,30) + end else - hist(y0,30) + if isoctave + hist(y0,30) + else + histogram(y0,30) + end end title(options_map.title,'interpreter','none') subplot(222) diff --git a/matlab/plot_identification.m b/matlab/plot_identification.m index 19b7836ae9..4afbf7ff2e 100644 --- a/matlab/plot_identification.m +++ b/matlab/plot_identification.m @@ -411,13 +411,25 @@ else end hh_fig = dyn_figure(options_.nodisplay,'Name','MC Condition Number'); subplot(221) - hist(log10(idemodel.cond)) + if isoctave + hist(log10(idemodel.cond)) + else + histogram(log10(idemodel.cond)) + end title('log10 of Condition number in the model') subplot(222) - hist(log10(idemoments.cond)) + if isoctave + hist(log10(idemoments.cond)) + else + histogram(log10(idemoments.cond)) + end title('log10 of Condition number in the moments') subplot(223) - hist(log10(idelre.cond)) + if isoctave + hist(log10(idelre.cond)) + else + histogram(log10(idelre.cond)) + end title('log10 of Condition number in the LRE model') dyn_saveas(hh_fig,[IdentifDirectoryName '/' fname '_ident_COND' ],options_.nodisplay,options_.graph_format); options_mcf.pvalue_ks = 0.1; -- GitLab