Unexplicable "Operands to the logical AND .." error from "histogram" command
2 次查看(过去 30 天)
显示 更早的评论
I have a script written on a computer using Matlab 2023a, which runs without problems. I ran that script on another PC, with a new installation of Matlab 2023a (preference folder copied from the old PC). The script seems to stumble with the histogram command, always throwing the error
Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values.
Error in histogram (line 63)
if nargin == 3 && ishandle(varargin{end}) && varargin{end} ~= 0
Without detailing the data structures of said script, a minimal running example is the one found in the Matlab documentation example:
x = randn(1000,1)
h = histogram(x,'Normalization','probability')
which gives the same error as above.
To recap, Matlab versions, settings, file paths, and script contents, are all identical between the two PCs, yet this histogram error Is only thrown on the newer PC. Any ideas?
0 个评论
采纳的回答
Walter Roberson
2024-2-25
In R2023a, the first line of histogram.m that is not a comment, is line 134; you are getting the error on line 64.
You have some third-party histogram function that is interfering.
which -all histogram
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!