Page 1 of 1

Windows and Logfile

Posted: Thu 21 Jul 2016, 11:43
by frankst
I recognized that the openEMS logfile is working on Windows only if silent=1.
The problems seems to be the missing "tee" command.
Windows Powershell provides this command.
I edited "invoke_openEMS.m" to make use of it.
Below is an excerpt of my edited file.

I hope you find this useful.


Excerpt invoke_openEMS.m:
command = [openEMS_bin ' ' opts];

if ~silent
if nargin>1
if isunix
command = [command ' 2>&1 | tee ' logfile];
command = ['powershell ' command ' 2>&1 | tee ' logfile];
command = [command ' > ' logfile ' 2>&1'];


Re: Windows and Logfile

Posted: Thu 21 Jul 2016, 20:27
by thorsten
Does windows have this for all supported version? At least Win 7 to 10 would be necessary.

Furthermore, does it open a dedicated powershell? Or is the output still inside Octave/Matlab?

Would the diary functionality be a better alternative?


Re: Windows and Logfile

Posted: Fri 22 Jul 2016, 08:57
by frankst
I tried it on Win7 Pro and Win10 Pro. Both work (for me...).
As far as I know the powershell is available on any newer Windows.
In case of doubt, one could add a test if the command "powershell" exists.

The output remains in the Octave window (I don't have Matlab, hence I can't test).

The "diary" function only dumps the output of the Octave script to a file. But not what is created by openEMS.
On the other hand, the openEMS logfile only contains the output of openEMS. But not what the Octave script produces.
In the end, I use both, logfile and diary, to get the full output. Though the output remains split in two files.
I have not found a way to dump all output to one file.