Error when trying to use stackedplot with more than 1 y-value per plot

Initially I wanted to post my question concerning my own code, but I noticed that not even the corresponding examples seem to work.
stackedplot works fine with one table, but as soon as I try to incorporate a second table (with matching column names) to get 2 plots in the corresponding subplots, I get the error "Error using stackedplot (line 71) Variables to plot must be a valid data type." I tried to simplify the problem, even tried 2 identical tables, always the same error. So I tried the supplied examples, same behavior:
So - as not even the example works as expected, I started to suspect my MATLAB installation. I work on R2020b and tried to use a fresh install of R2018b, where the function was introduced. Same error on both installations.
Did somebody encounter this before? Might get back to subplots, if I can't figure this out.
Greetings
Tommy

 Accepted Answer

Ok, I figured it out, sorry to have bothered.
The specific feature of stackedplot I was trying to use was incorporated into the function later, it works with MATLAB R2022b and later.

More Answers (1)

The feature to use multiple tables in stackedplot wasn't introduced until R2022b (see the "More About" section).
So, there's nothing wrong with earlier installs and there's no point in trying this route unless/until upgrade to at least R2022b. Seems a nice enhancement, but you're out of luck...

1 Comment

Thank you for your quick reply! Just figured it out myself a couple of minutes ago. Feel dumb now ;)

Sign in to comment.

Categories

Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange

Products

Release

R2020b

Community Treasure Hunt

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

Start Hunting!