I'm not entirely sure how, but my copy of MATLAB R2013b has stopped showing which line my errors occur at.
I'll just get errors like:
Subscripted assignment dimension mismatch.
But no line number to go along with it, so I have no idea which part of my code is causing the problem!
Did I mess up a setting somewhere?
Enable line numbering in the editor with Preferences -> Editor/Debugger -> Display -> Show line numbers
When running code segments (for example, using Ctrl+Enter with the Windows default key bindings), line numbers will not be displayed. You can see the line on which the error is caused by directly running the script or calling the function in which it occurs.
Related
I just installed Rascal and Eclipse (4.7.2) on Windows 10.
I've imported CLaiR (C Language Analysis in Rascal) and am trying to parse an existing C program
rascal>import lang::cpp::AST;
ok
rascal>parseCpp(|file:///c:/users/user/testme.cpp|)
I get a little over a screenful of information. The last line looks truncated and the last 3 characters are ...
Am I right? How do I increase how much is shown?
I've tried:
1. Windows, Preferences, Terminal, Terminal Buffer Lines = 1000000
2. Windows, Preferences, Run/Debug, Console, Console Buffer Size = 1000000
Any other ideas?
We indeed truncate the output of the result of an REPL command.
If you pass the value into iprintln (i for indented), you will get the full value. There is also iprintToFile to write it to a file. Another option is to use the functions util::ValueUI to view the value as either a collapsable tree, indented text, or a graph.
When i use the text command, it does do its work but gives a warning:
Warning: Error updating Text. Following is the chain of causes of the
error:
String must have valid interpreter syntax:
^
The trouble is when i have to use the text command in a for loop 1000 times, the entire command window gets flooded with warnings which is sometimes inconvenient. I use the text command as follows.
figure();
set(gca,'YAxisLocation','Right','YDir','reverse')
axis([0 11 0 11]);
daspect([1,1,1])
rectangle('Position',[2,3,1,1])
text(5,6,'^');
view([-90 -90])
is there a work-around? I don't want the warning to be displayed. What is causing the warning?
EDIT:
Is there a way to put text in plot in matlab in any other way where this will not be encountered?
Characters like ^,\, etc are interpreted in a pre-defined manner in Matlab hence pose difficulty. Use:
text(5, 6, '\^');
Set the interpreter to "none".
For example:
text(1,1,'c:\games\digger','interpreter','none')
This applies also for TITLE, XLABEL and other similar commands.
I couldn't reproduce you problem (Ubuntu, R2014b). However, to get rid of warning messages you can simply disable/enable the warnings around your problematic line:
warning off
text(5, 6, 'T');
warning on
I'm not entirely sure how, but my copy of MATLAB R2013b has stopped showing which line my errors occur at.
I'll just get errors like:
Subscripted assignment dimension mismatch.
But no line number to go along with it, so I have no idea which part of my code is causing the problem!
Did I mess up a setting somewhere?
Enable line numbering in the editor with Preferences -> Editor/Debugger -> Display -> Show line numbers
When running code segments (for example, using Ctrl+Enter with the Windows default key bindings), line numbers will not be displayed. You can see the line on which the error is caused by directly running the script or calling the function in which it occurs.
On most instances of MATLAB I've used, whenever I had a bug in my code the error message in the command window would show the line number.
However on the computer I am currently using, it shows me only the following:
??? Subscripted assignment dimension mismatch.
Is there anyway to get the line number to show again instead of ?????
What you are doing is using Run Section or Run and Advance as #canzar said. If you run scripts like this there is no 'line number', just as when you copy-paste code and run it in the command-window will not show you the line number on the error.
If you run the script using run or by pressing F5 it does know the line number and then prints that on the error statement. Good to know for debugging is to go to the tab editor->breakpoints->dbstop on error. If you press that it will keep your variables as present when the memory occurs, as opposed to throwing everything out when debugging functions.
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).