MATLAB Answers

ga rec
0

clear all output code

Asked by ga rec
on 12 Aug 2019
Latest activity Commented on by Guillaume
on 20 Aug 2019
Is it possible in matlab live script to "clear all output" with a program code?

  7 Comments

ga rec
on 16 Aug 2019
Thanks for the answer. I think I have to precisise my issue:
I have a lot of calculations and I want to display some of them at determined positions in the output where the required results are not calculated yet.
I think the easiest way with the least effort is to calculate the results in the first run of a loop and display them at the second run of the program. Therefore I need a solution to "Clear All Output" in the code. I think I need a handle for the "Clear all Output"-button, but I can't find one.
Guillaume
on 16 Aug 2019
Maybe you want to attach your mlx file so we have an idea of what you mean.
ga rec
on 16 Aug 2019
I'm looking for a code or handle to execute the "Clear all Output"-botton (marked in the photo below) in the program
example.png

Sign in to comment.

1 Answer

Answer by Sai Bhargav Avula on 20 Aug 2019

Currently you cannot programmatically set the clear output in Live Editor. There are only two ways to do this. First, the one you mentioned and the other by right clicking anywhere in the script and selecting the Clear All Output option.

  5 Comments

Rik
on 20 Aug 2019
Using evalc has no advantage over the setup below and it has all the downsides of eval.
A=zeros(1,4);
for n=1:2
A=A+rand(1,4);
if n==2
disp(A)
end
end
ga rec
on 20 Aug 2019
Thanks for the answers.
@ Sai Bhargav Avula: I have a lot of figures in the output
@ Ric: I have the same idea Rik, but therefore i need a lot of additional code in the livescript environment and for presentation reasons it's not a solution for me with all the additional code.
Does nobody has an idea how to create a handle for the button?
Guillaume
on 20 Aug 2019
Typically, matlab does not give you programmatic access to its interface, so the answer to "how to create a handle for the button" is very likely: it's not possible.
There are some undocumented ways to hack into some of the interface (mostly the editor and command window) but as far as I know, there's no way to interact with the toolbar.

Sign in to comment.