Why do I recive the error "Attempt to execute SCRIPT hist as a function: /Users/TrulsKnarvik/Documents/BI/Master/4. år/1. semester/Econometrics/MATLAB/hist.m Error in tabulate (line 52) [counts values] = hist(y,(1:maxlevels));"
Mostrar comentarios más antiguos
Attempt to execute SCRIPT hist as a function: /Users/TrulsKnarvik/Documents/BI/Master/4. år/1. semester/Econometrics/MATLAB/hist.m
Error in tabulate (line 52) [counts values] = hist(y,(1:maxlevels));
Respuestas (1)
Hi,
rename your script. hist is a matlab function and it causes the problem if you save your script with the same name. Call it histo.m for example to avoid problems. This is because if you call the MATLAB hist function:
[counts values] = hist(y,(1:maxlevels));
Matlab searches for this function and finds your script as first. Then it tries to call this script with the input arguments:
y,(1:maxlevels)
Since your script is not a function accepting inputs it throws the error. Even if your script were a function that accepts inputs, that would certainly not be what you want to achieve with your code. What you want to do is calling the MATLAB hist function.
In general NEVER name your scripts with names of MATLAB functions.
Best regards
Stephan
1 comentario
Categorías
Más información sobre Histograms en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!