Thread Subject: how to make command history permanent?

Subject: how to make command history permanent?

From: huhua

Date: 2 Jun, 2008 22:36:14

Message: 1 of 7

Hi all,

The current Matlab command history window only keeps a small number of
command histories. Is there a way to make all the history entries kept
permanently?

Thanks!


Subject: how to make command history permanent?

From: Rune Allnor

Date: 3 Jun, 2008 10:07:44

Message: 2 of 7

On 3 Jun, 00:36, "huhua" <lunamoonm...@gmail.com> wrote:
> Hi all,
>
> The current Matlab command history window only keeps a small number of
> command histories. Is there a way to make all the history entries kept
> permanently?

Maybe not exactly what you want, but something
close. In the mid/late '90s I used to use the
DIARY to save my commands.

You can do something like this in startup.m:

diaryname=['matlab-session-log-',date];
diary(diaryname);
clear diaryname;

Everything that goes on in the command window
is mow logged to the specified file, including
output as well as commands.

This archive saved me on numerous occations,
but the files tend to be large if you work
a lot with matlab, not to mention if you
accidently print out a 100 MB array to the
command window. So use this logging system
very cautiosly unless you have a very large
disk!

Maybe not as big a problem nowadays with the PC
as it used to be on the UNIX servers, but if you
stay logged in for days as I used to back then,
be aware that the date of the file is set when
matlab is started, not when the work is done.

Rune

Subject: how to make command history permanent?

From: Steven Lord

Date: 3 Jun, 2008 13:26:43

Message: 3 of 7


"Rune Allnor" <allnor@tele.ntnu.no> wrote in message
news:86752402-6902-4f73-bf7d-429ac8b16771@s50g2000hsb.googlegroups.com...
> On 3 Jun, 00:36, "huhua" <lunamoonm...@gmail.com> wrote:
>> Hi all,
>>
>> The current Matlab command history window only keeps a small number of
>> command histories. Is there a way to make all the history entries kept
>> permanently?

No, not unless you make a backup copy of the M-file in your PREFDIR that
contains the command history periodically.

> Maybe not exactly what you want, but something
> close. In the mid/late '90s I used to use the
> DIARY to save my commands.
>
> You can do something like this in startup.m:
>
> diaryname=['matlab-session-log-',date];
> diary(diaryname);
> clear diaryname;
>
> Everything that goes on in the command window
> is mow logged to the specified file, including
> output as well as commands.

You can do something similar when you start MATLAB by using the -logfile
option.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabwindows.html

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabunix.html

*snip*

--
Steve Lord
slord@mathworks.com


Subject: how to make command history permanent?

From: huhua

Date: 4 Jun, 2008 00:51:46

Message: 4 of 7


"Steven Lord" <slord@mathworks.com> wrote in message
news:g23gqj$8qb$1@fred.mathworks.com...
>
> "Rune Allnor" <allnor@tele.ntnu.no> wrote in message
> news:86752402-6902-4f73-bf7d-429ac8b16771@s50g2000hsb.googlegroups.com...
>> On 3 Jun, 00:36, "huhua" <lunamoonm...@gmail.com> wrote:
>>> Hi all,
>>>
>>> The current Matlab command history window only keeps a small number of
>>> command histories. Is there a way to make all the history entries kept
>>> permanently?
>
> No, not unless you make a backup copy of the M-file in your PREFDIR that
> contains the command history periodically.
>
>> Maybe not exactly what you want, but something
>> close. In the mid/late '90s I used to use the
>> DIARY to save my commands.
>>
>> You can do something like this in startup.m:
>>
>> diaryname=['matlab-session-log-',date];
>> diary(diaryname);
>> clear diaryname;
>>
>> Everything that goes on in the command window
>> is mow logged to the specified file, including
>> output as well as commands.
>
> You can do something similar when you start MATLAB by using the -logfile
> option.
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabwindows.html
>
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/matlabunix.html
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
>
>


Thanks! But I don't like log all the outputs. Because that's going to be
huge. I just want all the command histories.

For example, I have been desperately looking for my command history back to
Dec. 2007.

But I couldn't find anywhere. I got to know that Matlab command history has
a default length limit of 20K, which is bad desgin.

I think it should just allow an infinite amount of command history to be
saved.

Why cares about the size of those texts today with large harddisk? The most
important is the convenience of being able to dig out which command one has
used a few months ago.



Subject: how to make command history permanent?

From: Matt Fig

Date: 4 Jun, 2008 01:38:01

Message: 5 of 7

 > Thanks! But I don't like log all the outputs. Because
that's going to be
> huge. I just want all the command histories.

>I got to know that Matlab command history has
> a default length limit of 20K, which is bad desgin.
>
> I think it should just allow an infinite amount of command
history to be
> saved.
>
> Why cares about the size of those texts today with large
harddisk? The most
> important is the convenience of being able to dig out
which command one has
> used a few months ago.


Your statements don't seem to add up. You are worried about
saving output because it will be "huge," but you vent
against Matlab's "bad design" for not storing "infinite"
command history? What is "huge" next to "infinite?"

I too had to learn the hard way. If you are doing something
that is valuable (or complex) and you think you may need for
future reference, save it in a script file.

Subject: how to make command history permanent?

From: Bjorn Gustavsson

Date: 4 Jun, 2008 07:22:02

Message: 6 of 7

"Matt Fig" <spamanon@yahoo.com> wrote in message
<g24rlp$m7v$1@fred.mathworks.com>...
> > Thanks! But I don't like log all the outputs. Because
> that's going to be
> > huge. I just want all the command histories.
>
> >I got to know that Matlab command history has
> > a default length limit of 20K, which is bad desgin.
> >
> > I think it should just allow an infinite amount of command
> history to be
> > saved.
> >
> > Why cares about the size of those texts today with large
> harddisk? The most
> > important is the convenience of being able to dig out
> which command one has
> > used a few months ago.
>
>
> Your statements don't seem to add up. You are worried about
> saving output because it will be "huge," but you vent
> against Matlab's "bad design" for not storing "infinite"
> command history? What is "huge" next to "infinite?"
>
Seriously MAtt, it is after all a question of how _fast_
things grow. For this statement:

A = ones(1e4)

we dont really need the output, do we?
Bjorn

Subject: how to make command history permanent?

From: Rune Allnor

Date: 4 Jun, 2008 10:40:49

Message: 7 of 7

On 4 Jun, 03:38, "Matt Fig" <spama...@yahoo.com> wrote:
> =A0> Thanks! But I don't like log all the outputs. Because
> that's going to be
>
> > huge. I just want all the command histories.
> >I got to know that Matlab command history has
> > a default length limit of 20K, which is bad desgin.
>
> > I think it should just allow an infinite amount of command
> history to be
> > saved.
>
> > Why cares about the size of those texts today with large
> harddisk? The most
> > important is the convenience of being able to dig out
>
> which command one has
>
> > used a few months ago.
>
> Your statements don't seem to add up.

Having been where the OP seems to be, I can assure you
the statements add up!

>=A0You are worried about
> saving output because it will be "huge,"

Others already commented on that...

> but you vent
> against Matlab's "bad design" for not storing "infinite"
> command history? =A0What is "huge" next to "infinite?" =A0

There is a limit to how much input a human can supply
through the command line, maybe a few kB per day.
The output can be immense.

> I too had to learn the hard way. =A0If you are doing something
> that is valuable (or complex) and you think you may need for
> future reference, save it in a script file.

That's what I do these days. One problem with thit
approach is that I often run the scripts from the
Editor window by pressing the F5 key. Thise events
are not logged in neither the command history nor
diary, since the command window is bypassed.

I would suggest that somebody who has the privelege to
submit a product enhancement request (I don't as I didn't
renew the matlab support agreement) asks for a modification
such that commands (including F5's in the editor window)
are logged in a specified file, which the user can specify
in startup.m.

All the functionality necessary to make such a feature
is already there, it's just a matter of putting the
pieces together.

Rune

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com