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
采纳的回答
更多回答(1 个)
dpb
2023-7-30
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...
类别
在 帮助中心 和 File Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!