pgfmathmin 和 pgfmathsetmacro 和数组

pgfmathmin 和 pgfmathsetmacro 和数组

我正在尝试计算数组的最小值和最大值。唯一未解决的问题是将值保存在宏/变量中。

\documentclass[utf8,fleqn]{scrartcl}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}


\begin{document}


\def\myarray{{3,4,5,6,7,8,9,10,11}}


\pgfmathmin{(\myarray)}{} \pgfmathresult

%\pgfmathsetmacro{\minim}{min(\myarray)} %does not work

%\pgfmathsetmacro{\minim}{min{\myarray}} %does not work

%\pgfmathsetmacro{\minim}{min({\myarray})} %does not work

%\pgfmathsetmacro{\minim}{min{(\myarray)}} %does not work

\end{document}

有人能帮忙吗?谢谢

答案1

这有效:

\expandafter\pgfmathmin\myarray{}

然后\pgfmathresult设置为3.0

相关内容