Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String Mathematica中字符串的列表名称_String_Wolfram Mathematica_Expression - Fatal编程技术网

String Mathematica中字符串的列表名称

String Mathematica中字符串的列表名称,string,wolfram-mathematica,expression,String,Wolfram Mathematica,Expression,考虑到: daList=Range[10] 我需要的是标题作为列表名称,但尝试: ListPlot[daList, PlotLabel -> ToString[daList]] 似乎不起作用 编辑 “达利斯特”是我想要的头衔很抱歉我之前的错误 编辑 我还不能解决任何问题,但我想我已经解决了这个问题。列表名称是一个打印函数参数。我相信复制我的问题的简单版本如下: list = {1, 2, 3, 4}; naming[list_] := ToString[HoldForm[list]

考虑到:

 daList=Range[10]
我需要的是标题作为列表名称,但尝试:

ListPlot[daList, PlotLabel -> ToString[daList]]
似乎不起作用

编辑

“达利斯特”是我想要的头衔很抱歉我之前的错误

编辑

我还不能解决任何问题,但我想我已经解决了这个问题。列表名称是一个打印函数参数。我相信复制我的问题的简单版本如下:

list = {1, 2, 3, 4};
naming[list_] := ToString[HoldForm[list]];
naming[list]
下面是我的“真实”代码:

sequenceCountPlot[conditionSet\uU4]:=
ListPlot[sequenceCountALL[conditionSet],
绘图选项[
(“DisplayNo looking Out filter”(ToString[HoldForm[conditionSet]]),
“显示器数量”,
“过滤半径(厘米)”,
前颜色],
PlotRange->{0,10},{0,Max@(Max/@sequenceCountALL[conditionSet])},Joined->True]
其中,plotOptions是一个用于自定义某些选项(标题和颜色)并使用其他选项调整打印的功能。 请注意,即使使用Evaluate[plotOptions],结果仍保持不变。

尝试以下方法:

ToString[HoldForm@daList]
所以

可能是

ListPlot[daList, PlotLabel -> StringJoin[Map[ToString, daList]]]
另一种可能性:

ListPlot[daList, PlotLabel -> ToString[Unevaluated[daList]]]

我认为最方便的两种方法是:

daList = Range[10];
ListPlot[daList, PlotLabel -> "daList"]
ListPlot[daList, PlotLabel -> HoldForm[daList]]
其他可能性:

ListPlot[daList, PlotLabel -> MakeBoxes[daList]]
ListPlot[daList, PlotLabel -> SymbolName[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[HoldForm@daList]]

字符串转换是什么意思?你想要的结果是什么?你的编辑增加了混乱。您的第一个图形已经有了“daList”作为标题。看起来所需的输出是
daList
(字面意思)作为标题。也许我误解了这个问题,对不起,纳赛尔@acl,我担心你根据我以前缺乏精确性/注意力的情况做出了很好的推断我把它理解为希望daList的值作为字符串。它在我当前的设置中不起作用,我有一个以列表名(表达式)作为输入的绘图函数:我认为这反映了问题:列表={1,2,3,4};命名[列表]:=ToString[HoldForm[列表];命名[名单];有什么想法吗?@500这里:
list={1,2,3,4};ClearAll[命名];SetAttributes[命名,保持优先];命名[列表]:=ToString[HoldForm[list]
ie,添加
SetAttributes[naming,HoldFirst]
在定义
命名之前
我即将放弃,当它嵌套在我的绘图函数中时仍然不起作用。你能从这个语法中看出明显的原因吗?sequenceCountPlot[conditionSet]:=ListPlot[sequenceCountALL[conditionSet]、plotOptions[(“显示无外部过滤器”命名[conditionSet])、“显示数量”、“过滤器半径(厘米)”、预着色)、PlotRange->{0,10}、{0,Max@(Max/@sequenceCountALL[conditionSet]),Joined->True]@500在不知道这应该做什么的情况下很难说,但是,
SetAttribute[sequenceCountPlot,HoldAll]
怎么样?我在猜测你希望这个做什么,所以也许它不会起作用,在这种情况下,在你的问题中加入一些细节。(请注意,您仍应将此属性设置为
命名
)@500,以便澄清:在这段代码中,
命名
根本看不到符号
条件集
:它只看到对其求值的结果,即列表(或其包含的任何内容)。设置我为
sequenceCountPlot
所说的属性意味着
naming
将接收符号,如果您也为
naming
设置了
HoldAll
,它将把它传递给里面的任何东西(如果您没有,它将计算并传递结果)。大概吧,但我希望你能理解。
daList = Range[10];
ListPlot[daList, PlotLabel -> "daList"]
ListPlot[daList, PlotLabel -> HoldForm[daList]]
ListPlot[daList, PlotLabel -> MakeBoxes[daList]]
ListPlot[daList, PlotLabel -> SymbolName[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[Unevaluated@daList]]
ListPlot[daList, PlotLabel -> ToString[HoldForm@daList]]