DataStore function returns an error
Show older comments
DataStore function returns an error which it shouldn't.
The version of MAtlab is 2018b
Error in line 169 too many input arguments
No problem of my number of the input arguments even the Matlab example does not work.
Line 169 in DataStore.m :
% call the constructor
ds = feval(dsName, location, varargin{:});

9 Comments
Walter Roberson
on 5 Apr 2020
Line 169 in DataStore.m :
DataStore.m is not a file name used in Mathwork's data store; the name used is datastore.m all lower-case.
The feval() call you show is present at roughly that line number, but I have to wonder whether you are using the correct functions.
Mehdi Shafiei
on 5 Apr 2020
Edited: Mehdi Shafiei
on 5 Apr 2020
Walter Roberson
on 5 Apr 2020
You said:
Line 169 in DataStore.m :
DataStore.m is not the same as datastore.m
Mehdi Shafiei
on 5 Apr 2020
Mehdi Shafiei
on 5 Apr 2020
Image Analyst
on 6 Apr 2020
Your screenshot shows MATLAB 2012, according to the copyright.
datastore() was introduced in R2014b, according to the bottom my my help documentation for datastore(). Are you sure you're running 2018b and not 2012b? Regardless, try downloading the latest r2020a and trying that.
per isakson
on 6 Apr 2020
I'm sure I run R2018b and I see the same "Copyright 2012".
Mehdi Shafiei
on 6 Apr 2020
per isakson
on 6 Apr 2020
No problem, see my answer.
Answers (2)
Walter Roberson
on 5 Apr 2020
0 votes

Notice from the header that this is R2018b.
Notice from the output that R2018b does not have a problem with that command.
2 Comments
Mehdi Shafiei
on 5 Apr 2020
Walter Roberson
on 6 Apr 2020
You have been modifying MATLAB functions. That makes it difficult for us to guess which modification you made might be interfering with the code.
per isakson
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
I use R2018b
>> version
ans =
'9.5.0.944444 (R2018b)'
The example of the help on datastore works as expected in the Live Editor

I cannot guess why it doesn't work on your system.
Proposal:
- Set a breakpoint at line 169 of datastore()
- Run datastore
- At line 169 display the values of the input variables
>> ds = datastore('airlinesmall.csv', 'TreatAsMissing','NA');
169 ds = feval(dsName, location, varargin{:});
K>> dsName, location, varargin{:}
dsName =
'matlab.io.datastore.TabularTextDatastore'
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
ans =
'NA'
K>>
Do you get a different values compared to mine?
12 Comments
Mehdi Shafiei
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
per isakson
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
The string 'NA' is missing, which explains why the error is thrown at line 169. Please, confirm that you didn't miss
ans =
'NA'
in the copy&paste operation.
per isakson
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
If varargin{:} indeed didn't display 'NA' at line 169, set a breakpoint at line 61, run datastore(), and display location, varargin{:} at line 61. I cannot see any reason why 'NA' would be lost between line 61 and 169.
>> ds = datastore('airlinesmall.csv', 'TreatAsMissing','NA');
61 if isstring(location)
K>> location, varargin{:}
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
ans =
'NA'
K>>
Show us a copy from your command window.
Mehdi Shafiei
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
Mehdi Shafiei
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
per isakson
on 6 Apr 2020
To make your screen copies more readable
- run format compact
- mark-up relevant text as CODE

"And what you think it means?"
- feval() often throws poor and misleading error messages. The problem is not with the line 169, but somewhere in the method/function that is called by line 169.
- I checked reported bugs at https://se.mathworks.com/support/bugreports without finding anything.
- This might be a question for "Create New Service Request", depending on what type of licence you have.
Otherwise next would be
- Set a breakpoint at line 169 of datastore()
- Run datastore
- At line 169 Step In, (F11)
- and step throw TabularTextDatastore until the error occurs.
See it as a debugging excercise.
Mehdi Shafiei
on 6 Apr 2020
Steven Lord
on 6 Apr 2020
Please contact Technical Support using the telephone icon (the Contact Us button) in the upper-right corner of this page.
Mehdi Shafiei
on 6 Apr 2020
per isakson
on 6 Apr 2020
Edited: per isakson
on 6 Apr 2020
"[...] I have traced the error and got into the method io.datastore.TabularTextDatastore()." It may well be, but you didn't report what you found.
"nor [...] affets readability" I disagree!
Mehdi Shafiei
on 7 Apr 2020
per isakson
on 8 Apr 2020
I find it hard to believe that the problem is caused by R2018b proper.
I think the most likely cause is that a function that is called (directly or indirectly) by TabularTextDatastore is shadowed by (has the same name as) a function, which you or someone else has created. Run
dbstop if error
dbstop if caught error
and then
ds = datastore('airlinesmall.csv', 'TreatAsMissing','NA');
The execution may halt at the call of the shadowed function.
Categories
Find more on Startup and Shutdown 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!