How can I get the session history programmatically in headless?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 22 de Feb. de 2016
Respondida: MathWorks Support Team
el 22 de Feb. de 2016
I would like to be able to programmatically query the session history in MATLAB (equivalent to what can be seen in the Command History). As there is no documented way to do this, I use the undocumented feature:
>> com.mathworks.mlservices.MLCommandHistoryServices.getSessionHistory
Unfortunately, in headless environment (no graphics), such as an SSH connection, this command throws:
Java exception occurred:
java.awt.HeadlessException
at java.awt.dnd.DragSource.<init>(Unknown Source)
at com.mathworks.mde.cmdhist.AltHistoryTable.<init>(AltHistoryTable.java:155)
at com.mathworks.mde.cmdhist.AltHistory$9.<init>(AltHistory.java:530)
at com.mathworks.mde.cmdhist.AltHistory.<init>(AltHistory.java:530)
at com.mathworks.mde.cmdhist.AltHistory.getInstance(AltHistory.java:268)
at com.mathworks.mde.cmdhist.AltHistory.getSessionCommands(AltHistory.java:408)
at
com.mathworks.mde.cmdhist.CmdHistoryRegistrar.getSessionHistory(CmdHistoryRegistrar.java:23)
at
com.mathworks.mlservices.MLCommandHistoryServices.getSessionHistory(MLCommandHistoryServices.java:33)
Respuesta aceptada
MathWorks Support Team
el 11 de Sept. de 2019
There is currently no documented way to query the session history.
Also, 'getSessionHistory' throws in headless, but there is not other undocumented feature that could work in headless.
The only workaround would be to manually parse the 'History.xml' file in the 'prefdir'. Note however that the structure of the 'History.xml' file is undocumented, and as such, can change at any time.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Scope Variables and Generate Names en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!