Error while calling a function a class
Show older comments
Hi all, Please help. I have a file with the name Bandit.m. It has a class defined Bandit. Code is as follows:
********************
classdef Bandit
properties
m
mean_val
N
end
methods
function self = Bandit(m)
self.m = m;
self.mean_val = 0;
self.N = 0;
end
function reward = pull_arm()
reward = randn() + self.m;
end
end
end
********************
Now, I have another file called test.m in the same directory. I run the following line and get the error. Code is as follows:
a = Bandit(5);
a.pull_arm();
when I run the above code, I get "Too many input arguments.". Am I doing some mistakes in the above 2 lines of code? I have been working with Python, but using MATLAB for the first time.
I am new to MATLAB. Can somebody help?
Accepted Answer
More Answers (0)
Categories
Find more on Environments in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!