MATLAB cannot plot LinearModel: "Unable to perform assignment because dot indexing is not supported for variables of this type."
3 次查看(过去 30 天)
显示 更早的评论
I created a LinearModel alpha_Approx (see attachment) by using fitlm function on a set of measured data points.
When I try to plot the result
plot(alpha_Approx);
I get the following error. It seems the error has something to do with "title" and not the data itself. Plus, when "Pause on error" was turned on, the workspace shows that the value of variable "this" is a complex number 0+0i.
How can I get rid of this error?
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in ctrluis.axesgroup/addbypass>localTitle (line 24)
this.Title = string;
Error in mwbypass (line 17)
hh = feval(fcn{:},varargin{:});
Error in title (line 75)
h = mwbypass(ax,'MWBYPASS_title',titlestr,pvpairs{:});
Error in LinearModel/plotxy (line 736)
title(ax,sprintf('%s',getString(message('stats:LinearModel:sprintf_AvsB',yname,xname))),'Interpreter','none');
Error in LinearModel/plot (line 56)
h = plotxy(lm,varargin{:});
>> plot(beta_Approx_Volleingriff)
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in ctrluis.axesgroup/addbypass>localTitle (line 24)
this.Title = string;
Error in mwbypass (line 17)
hh = feval(fcn{:},varargin{:});
Error in title (line 75)
h = mwbypass(ax,'MWBYPASS_title',titlestr,pvpairs{:});
Error in LinearModel/plotxy (line 736)
title(ax,sprintf('%s',getString(message('stats:LinearModel:sprintf_AvsB',yname,xname))),'Interpreter','none');
Error in LinearModel/plot (line 56)
h = plotxy(lm,varargin{:});
0 个评论
采纳的回答
Star Strider
2022-2-10
I have no idea what the rest of your code looks like, however I have no problem plotting it:
This code:
LD = load('alpha_Approx.mat');
alpha_Approx = LD.alpha_Approx;
figure
plot(alpha_Approx)
grid
produces this plot:
Check to be certain the model is in your workspace and that plot has access to it. Remember that functions have their own workspaces and will not share their outputs with the calling workspace unless they are specifically requested in the call to the function. The only situations I can think of (just now at least) is that ‘alpha_Approx’ is inside a function and the plot call is in the calling workspace and the model was not returned as an output from the function, or the reverse, that being that the model exists in the calling workspace, the plot call is inside a function, and the model was not passed to the function as an argument.
.
2 个评论
Star Strider
2022-2-11
As always, my pleasure!
Declaring a new figure is necessary (and something I always do) because that creates a new figure window and axes. Otherwise, the new plot attempts to plot in an existing figure window on the existing axes and replaces whatever was originally plotted (unless the hold condition is toggled 'on' and in that situation the subsequent plot call adds the plot to the existing axes).
The Control System and System Identification Toolbox plotting functions such as bode don’t play by the normal rules for plots. They have their own rules. That occasionally creates problems.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Filter Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!