Is there a method to store the command line outputs to a file in Julia.
The command history can be seen at .julia\logs\repl_history.jl in Windows OS.
I wish to store command line output also to a file automatically.
? command outputs also.
Whatever is shown in the julia command line, the whole text should be stored into a file.
Is there a way to do this.
found a similar qn : For Julia saving output to txt/CSV file?
If you run Julia in REPL mode in Widows using PowerShell, you can do the following in PowerShell:
Open the left upper corner menu and in Defaults, change the buffer size to something large enough for your needs, say 500.
After running Julia to do what you need, go the the left hand corner menu and choose Edit - Select all, then Copy. Paste to an editor.
Related
I would like to turn off word wrap in my vscode terminal so I can more easily view compiler messages.
e.g.
Imagine this is a very long line generated from a compiler and it has a lot of information and when it word wraps it is very hard to read so I would like vs code to just have a scroll bar at the bottom like SO has here.
However, after attempting several different methods of disabling word wrap, what is actually generated looks like:
Imagine this is a very long line generated from a compiler and it
t has a lot of information and when it word wraps it is very hard to read so I would like vs code to just have a scroll bar at the bottom like SO has here.
(extra t on the second line is intentional)
So it appears that I've managed to turn off word wrap internal to vscode, but something is still causing a carriage return (with no line feed), I think?
These messages are produced by running a C++ build task in the integrated terminal that in turn calls cmd.exe to run a script (e.g. cmd.exe <build command script>
Here is what I've tried so far:
First thing I tried was turning off word wrap in vscode (alt + z, or View > Word Wrap). This led to the weird line break described above.
I was suspicious that cmd was the one causing this weird line break, so I disabled "wrap text output on resize" and set the screen buffer width manually to 1000 (1000 >> greater than any of my output lines) within
command prompt properties for both "properties" and "default". I then tested the same command running in my vscode terminal and it worked as expected in the cmd terminal but still not vscode.
I was suspicious powershell (which I think vs code uses in it's integrated terminal?) was the one causing the line break, so I set the properties the same as in the cmd image above. Again this worked as expected in the powershell terminal, but still not vscode.
Following this, I changed the "terminal fixed dimensions" using the command from the command pallet and set the width to a matching column width of 1000 (leaving row empty for "automatic").
I've tried restarting vscode and my pc between several of these steps with no change.
What could be causing this behavior inside of the vscode terminal?
typing and executing a single line command in octave cli is simple.
for example a=1.
If one wants to edit this command and execute it again it is possible by navigating the history with the up/down keys.
But when executing a multi line command-script, one can still navigate to a single line and edit it, but how to execute the all script again, without going line by line in the history and "enter" the line?
for example:
for i=1:6
a(i) = i;
end
Is there a way to open the all script in an editor, edit, and re-execute it?
Yes there is, via the history command.
E.g. history -q 3 will display the last 3 commands -- the -q switch means do not prepend line numbers, such that the output is copy-pasteable.
You can also use the -w switch to redirect the output to a file, which you could then modify in your editor and call as a script, as you suggest.
If you're using the GUI, you can also use the history pane to highlight the lines you're interested in (in the order that you want them!), and paste directly into the editor window.
I want to use gvim as the standard editor for Matlab. It used to work on Linux but now I am forced to use windows and I can't seem to figure out how to set the editor such that files are opened in gvim in a new tab.
In the preferences there is a field which allows to pass a command that points to the prefered text editor. That works, but things fail when I try to give additional options, in my case that would be "--remote-tab-silent" to tell gvim to open the file in a running instance in a new tab. More specifically, the following line in the matlab preferences works:
C:\pathtovim\gvim.exe
while this one fails
C:\pathtovim\gvim.exe --remote-tab-silent
A command line opens with the following error message (my own translation from German):
The command ""C:\pathtovim\gvim.exe --remote-tab-silent"" is either spelled incorrectly or could not be found.
My guess is that it has something to do with the additional quotes, I have no idea why the command is issued with quotes, even though in the field I put it without. The follwing commands work when typed into the command line directly:
"C:\pathtovim\gvim.exe"
C:\pathtovim\gvim.exe --remote-tab-silent file.m
and this one fails:
"C:\pathtovim\gvim.exe --remote-tab-silent file.m"
I'd really appreciate any help! Thanks!
I can't find a good way to hack around it through the MATLAB settings; it looks like MATLAB is stupidly expecting the text editor to take only file names as arguments.
I think your best option, is to create a .bat script that simply passes any arguments it receives on to Vim, inserting the --remote-tab-silent.
I.e. create a .bat file with these contents:
"C:\pathtovim\gvim.exe" --remote-tab-silent %*
Then set up your MATLAB preferences to invoke the .bat file rather than Vim.
A lot of the code that I write in Matlab has a very verbose output. As the program runs, information is printed to the command window, and with each new line, the window automatically scrolls to the bottom. This becomes a problem when I want to read some of the output more closely or scroll up to look at older output. I can scroll up, but only until a new line is printed, which is often less than a second.
Does anyone know if it is possible to turn off this automatic scrolling in the Matlab window? I work in a number of different Matlab versions, depending on the machine, and this happens with all of them. The answer to this might be "No", but I swear I remember having this functionality at one point.
Use the more function: http://www.mathworks.com/help/matlab/ref/more.html
more on
Then run your program. Press spacebar when you wish to see more of the output.
more off will turn it off.
You may find this workaround useful.
First launch matlab using the command line matlab -logfile 'myLog.txt' (the doc says it "starts MATLAB and makes a copy of any output to the Command Window in filename. This includes all crash reports.")
Then open your .txt file using a text editor supporting automatic refresh of content (see picture). On OSX I use TextWrangler (freely available at www) but others have been reported to have this feature (see here or here).
Results: output displays (fprintf, disp, but not the commands per se) are printed both on the Matlab console and the text editor (file is refreshed with a little lag time, below half a second I would say with my configuration). And there is no automatic scrolling. Such procedure does not seem to impact the overall performance of the script (although it may deserve some testing).
I have a command in the command line of Matlab which is longer than just one line but when recalling it by pressing arrow-up, I just can go through every single line of the multiline-code... Is there a way to recall the complete last execution, no matter if just single or multiline?!
thanks!
In the Command History window, highlight the relevant lines and press F9 (or right-click and select Evaluate Selection if your shortcuts differ from mine).
The simplest solution is to right click the particular line in the command history window and select Copy or Evaluate Selection :)
If you'd like to copy a significant portion of your history, then you can output the contents of your history file (which is stored in history.m in the preferences directory) to the command window and copy from there.
type([prefdir '/history.m'])
%-- 20/6/11 3:17 PM --%
clc
outputVariable=someVeryLongFunctionNameThatMakesNoSense(inputVar1,'inputString1',inputVar2)
type([prefdir '/history.m'])
The above command and the screenshot were on a Mac. As always, be careful with the / on Windows. I can never remember which way it leans...