MATLAB Answers

New install 2021a not plotting data

4 views (last 30 days)
howe on 23 Jul 2021
Commented: howe on 26 Jul 2021
Just upgraded from 2019b to 2021a. Standard workflow for plotting data not working in 2021a.
Variable: Y is 5500000x1 double containing reals from -500 to +500 at 4 decimal precision
Calling figure; plot(Y) gives this error:
Array indices must be positive integers or logical values.
Error in
Error in
Error in newplot (line 77)
ax = gca(fig);
Error in (line 11)
axReturn = newplot(varargin{:});
Same data, same command in 2019b plots without issue. Note, even setting Y = [1;2;3;4] and calling plot(Y) fails and gives same error. Is this an installation problem? Some weird incompatibility?
Konrad on 23 Jul 2021
Yes, thats weird! I'd rerun the installer.

Sign in to comment.

Answers (2)

Steven Lord
Steven Lord on 23 Jul 2021
Let's make sure you haven't accidentally written or downloaded a function that is taking precedence over the built-in functions and the functions included in MATLAB. What do these commands display?
which plot
built-in (/MATLAB/toolbox/matlab/graph2d/plot)
which gca
built-in (/MATLAB/toolbox/matlab/graphics/gca)
which newplot
which get
built-in (/MATLAB/toolbox/matlab/graphics/objectsystem/get)
  1 Comment
howe on 26 Jul 2021
Steven, as outlined below, none of the functions were overwritten. I reinstalled (clean) and got the same problem. Found a solution to fix the problem transiently (while in same session):
rehash toolboxcache
So something is going wrong with the path.
I can live with this. But another problem has arisen: now I can't open apps, such as the Signal Analyzer. Matlab just hangs, indefinitely (like overnight if allowed), trying to open the app. Any thoughts on this would be appreciated, especially since: 1) R2019 was working perfectly in my hands for years; 2) I reinstalled R2021a twice and still have the same trouble. Thanks.

Sign in to comment.

howe on 23 Jul 2021
Thanks Steven.
built-in (C:\Program Files\MATLAB\R2021a\toolbox\matlab\graph2d\plot)
built-in (C:\Program Files\MATLAB\R2021a\toolbox\matlab\graphics\gca)
C:\Program Files\MATLAB\R2021a\toolbox\matlab\graphics\axis\newplot.m
built-in (C:\Program Files\MATLAB\R2021a\toolbox\matlab\graphics\objectsystem\get)
Returns look correct.
  1 Comment
howe on 23 Jul 2021
I am starting to get all sorts of weird errors. I suspect something didn't work correctly with the install. I was just running some basic calculations on arrays and got the following error chain:
Warning: Error occurred while executing the listener callback for event POST_REGION defined for class matlab.internal.language.RegionEvaluator:
Error using set
Too many input arguments.
Error in findall (line 37)
c = onCleanup(showHiddenHandlesToFindAllHandles(rootobj));
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager
Error in matlab.internal.editor.FigureManager.snapshotAllFigures
This is what I was wunning (as livescript):
efreq=1000; %1000 Hz sampling
epochlength=1000; %1 second at 1000 Hz
L = zeros(numepochs,1);
for ct = 1:numepochs
start = (ct-1)*epochlength+1;
stop = ct*epochlength;
for e = start:stop
linelen = linelen + abs(eeg(e,1));
linelen = 0;

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by