MATLAB Answers

Odd Subplot Behavior - Script interpreter bug?

1 view (last 30 days)
Wick on 28 Jun 2018
Commented: Wick on 28 Jun 2018
I've got a script that produces some plots. It's nothing fancy. I haven't included all the variable definitions in the code snippet below because they're not important. But you can see, I'm just using subplot and plot to make a bunch of plots.
If I just consider one loop (for jj = 1:1) I get the following set of plots.
If I allow jj to advance to 2 (for jj=1:2) I get this next set of images. Notice that the bottom plot in the first column is changed (and the axes go all whacky) but the second loop didn't change any of the first column plots.
Finally, if I let jj advance to 3 (for jj=1:3) The bottom plot in the middle column also gets ruined.
Now, here's the really weird part. If I change jj by hand and then copy/paste the same commands from the script editor into the interpreter I don't see any odd behavior at all. New columns are added and previous columns remain unchanged. I'm attaching the 'fig' file for the last plot as well as a snippet of the code I'm using.
Thanks in advance for anyone that can give me a workaround or (better yet) a solution!
I saw the same behavior in 2017b and 2018a. I'm using Windows 10 64-bit on an AMD Threadripper cpu.
for jj = 1:1
% variable_definitions_here
Wick on 28 Jun 2018
It's coming from a code that loads a bunch of data from a lookup table with lots of custom functions so I'll see if I can reproduce this with a smaller block of data and code and post that.
The really weird thing is that when I copy/paste the code into the interpreter the plots come out fine. That's what leads me to believe it's not a variables definition thing.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!