How can I create a method which takes an excel file as an argument in a constructor?
Show older comments
Basically, I'm trying to construct a method that allows users to input a data file. It can be excel or ascii, and the method reads it as a matrix which can then be tested on.
Here is some of the rudimentary code I've modified from the tutorial:
classdef BankAccount < handle
properties (Hidden)
AccountStatus = 'open';
end
properties (SetAccess = private)
VEC
AccountBalance = 0;
end
events
InsufficientFunds
end
methods
function BA = BankAccount(filename, InitialBalance)
BA.VEC = xlsread(filename);
BA.AccountBalance = InitialBalance;
then I try: BankAccount('sample.xlsx',55)
I'm getting an error: No public field VEC exists for class BankAccount.
Error in BankAccount (line 20) BA.VEC = xlsread(filename);
Accepted Answer
More Answers (1)
Jordan Ledvina
on 16 Jan 2013
0 votes
1 Comment
Cedric
on 16 Jan 2013
Great! I already had issues with '<' in other contexts after cut and paste from PDFs. If you deleted < handle and rewrote it afterwards it might be something similar that happened.. I guess you'll discover that after your next cut and paste ;-)
Cheers,
Cedric
Categories
Find more on Use COM Objects in MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!