# history

history manager.

## Syntax

* history()
* c = history()
* s = history('size')
* f = history('filename')
* l = history('enable\_save')
* c = history('get')
* history('display')
* history('save')
* history('load')
* history('clear')
* history('duplicated')
* history('saveafter')
* history('removeexit')
* history('size', new\_size)
* history('enable\_save', true\_false)
* history('delete', lines)
* history('append', str)
* history('filename', name)
* history('load', filename\_history)
* history('save', filename\_history)
* history('duplicated', true\_false)
* history('removeexit', true\_false)
* history('get', lines)
* history('saveafter', nb\_commands)

## Input argument

* new\_size - a integer value: new size max of history.
* true\_false - a logical.
* lines - a integer value or a vector of size 1x2.
* str - a string.
* name - a string: new default history filename
* filename\_history - a string: filename
* nb\_commands - a integer value: number of commands.

## Output argument

* c - a cell of strings.
* l - a logical.
* s - a integer value.
* f - a string.

## Description

**history()** displays the current Nelson history.

**c = history()** returns the current Nelson history in a cell of strings.

**s = history('size')** returns history size max.

**f = history('filename')** returns the history filename.

**l = history('enable\_save')** returns the history manager state.

**c = history('get')** returns the current Nelson history in a cell of strings.

**history('display')** displays the current Nelson history.

**history('save')** saves current history file.

**history('load')** load current history file.

**history('clear')** clears history.

**history('duplicated')** get state about save of consecutive duplicated commands.

**history('saveafter')** get state about save the history after nth commands.

**history('removeexit')** get state about do not save exit in history file.

**history('size', new\_size)** set history size max with **new\_size**.

**history('enable\_save', true\_false)** set the history manager state: false for 'off', true for 'on'.

**history('delete', lines)** deletes lines by index: a scalar value or a vector 1x2.

**history('append', str)** append command to history.

**history('filename', name)** set the history filename.

**history('load', filename\_history)** load history file.

**history('save', filename\_history)** save history file

**history('duplicated', true\_false)** set state about consecutive duplicated commands. true remove duplicated.

**history('removeexit', true\_false)** set state about do not save exit in history file.

**history('get', lines)**&#x72;eturns the current Nelson history in a cell of strings by index: a scalar value or a vector 1x2.

**history('saveafter', nb\_commands)** saves the history file after **nb\_commands** statements are added to the file.

**Tips**: You can easily share your history file in the cloud by adding few lines code in your user startup file.

If nelson launched with '--nouserstartup' option, history file will be not loaded at startup and not saved at exit.

## Examples

Example to share your history file in OneDrive cloud

```matlab
OneDrivePath = getenv('OneDrive');
if (strcmp(OneDrivePath, '') == false)
  NelsonOneDrivePath = [OneDrivePath, '/Nelson'];
  mkdir(NelsonOneDrivePath);
  NelsonOneDrivePathFilename = [NelsonOneDrivePath, '/', 'Nelson.history'];
 history('filename', NelsonOneDrivePathFilename);
  history('load', NelsonOneDrivePathFilename);
end
```

```matlab
history()
c = history()
```

## See also

[diary](../stream_manager/diary).

## History

| Version | Description     |
| ------- | --------------- |
| 1.0.0   | initial version |

## Author

Allan CORNET
