是否有从所有输出中清除工作表的命令? (不使用图形用户界面)

is there a command to clear the worksheet from all output? (not using GUI)

我使用工作表(不是文档模式)。 我知道可以做到 Edit>Remove Output>From Worksheet 到 "Removes Maple output from all execution groups in a worksheet."

但是我找不到执行此操作的命令。我需要这样做,因为当我 运行 一个循环时

for i from 1 to n do
    some_function();
od

上面的函数说打印到屏幕(即当前打开的工作表)很多信息,然后工作表变慢,我真的也不想看到以任何方式累积的所有调用的日志记录。我一次只需要查看一个迭代的打印件。

(Maple 在工作表中也有大量输出累积的其他问题,但这是另一个主题)。

我想做这样的事情

for i from 1 to n do
    some_function();
    delete_all_output_in_current_worksheet();
od;

因此只有一个调用的输出显示为 some_function 是 运行ning。

在 Matlab 中,使用 clc 可以轻松完成此操作,它会清除 Matlab 中的命令 windows。

Maple里面有没有类似上面的东西?

Maple 2018.1 windows.

没有编程方式来清除当前工作表的所有输出。

但是您可以将 some_function() 的 运行 结果(每次通过循环)推送到嵌入式组件,例如。 TextBox、MathContainer 等

您甚至不必从调色板中手动插入此类组件。相反,您可以使用 DocumentTools:-Tabulate 命令以编程方式在当前执行组之后插入一个表格化的组件集合。

例如,作为工作表中的一维代码,您可以将这些代码块放在三个单独的执行组中。

restart;

并且,

some_function:=proc(i)
    int( sin(x)^i, x);
end proc:

Leafcutoff := 150:

并且,

# Put all this in the same Execution Group
for i from 1 to 111 by 10 do

  res[i] := some_function(i);

  K := MmaTranslator:-Mma:-LeafCount(res[i]);
  if K <= Leafcutoff then
    L := res[i];
  else
    L := sprintf("LeafCount > %a",Leafcutoff);
  end if;
  DocumentTools:-Tabulate(
      [["i","LeafCount","result"],
       [sprintf("%a",i), K, L]],
      ':-weights'=[10,10,40],
      ':-fillcolor'=((T,i,jj)->`if`(i=1,"grey",
                                    "white")),
      ':-widthmode'=':-pixels',
      ':-width'=600);
  Threads:-Sleep(1.5); # delay at least 1.5 sec

end do:
DocumentTools:-Tabulate([[]]):

我设置了 1.5 秒的延时只是为了说明它的工作原理。您可以调整或删除它。

最后一次调用 Tabulate 只是为了在循环结束时将其清空。

Tabulate 插入的 GUI Table 实际上出现在执行组之后的区域中。每个执行组只出现一个这样的区域。基本上,每次调用 Tabulate 都会覆盖该区域。

如果您将 end do: 更改为 end do; 那么所有常规输出也会显示,就像循环一样。