DataStore function returns an error

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

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
Mehdi Shafiei on 5 Apr 2020
Edited: Mehdi Shafiei on 5 Apr 2020
I am not using feval(), but datastore.m. The problem sustained when I tried using tabularTextDatastore().
Clarify what you mean by "the correct function".
You said:
Line 169 in DataStore.m :
DataStore.m is not the same as datastore.m
OK! Yes! You mean that!
I correcetd it : datastore.m.
The file DataStore.m that I used was my attempt to replace some lines. Ignore it please and if you may answer my question, plz.
It is clear that Matlab 2018b has problems running its own Example as I sent it by a screenshot!
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.
I'm sure I run R2018b and I see the same "Copyright 2012".
@per! do you have the same problem or it is running through?
@Image very strange! I don'rt know what it means. I am sure that I use 2018b I tried on a 2018a on another machine and it works.
It is a very strange problem and I have not modified any function that is in use.
The same functions the same m files and the problem is there for one.
No problem, see my answer.

Sign in to comment.

Answers (2)

Notice from the header that this is R2018b.
Notice from the output that R2018b does not have a problem with that command.

2 Comments

It clears up that there shouldn't be a problem with the version.
Good! and thanks!
But where is the problem then?
You have been modifying MATLAB functions. That makes it difficult for us to guess which modification you made might be interfering with the code.

Sign in to comment.

per isakson
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

>> version
ans =
'9.5.0.1298439 (R2018b) Update 7'
K>> dsName, location, varargin{:}
dsName =
'matlab.io.datastore.TabularTextDatastore'
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
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.
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.
Sorry! Here it is!
And what you think it means?
K>> dsName, location, varargin{:}
dsName =
'matlab.io.datastore.TabularTextDatastore'
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
ans =
'NA'
K>> location, varargin{:}
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
ans =
'NA'
K>>
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.
I think I have just said that I have traced the error and got into the method io.datastore.TabularTextDatastore(). Good that another one is on to this.
This should be open for further discussion. Current status is "unsolved."
This is interesting: "
  • This might be a question for "Create New Service Request", depending on what type of licence you have."
Appreciated if you further explain it!
BTW I am not a fond buttons nor think the old copy and past affets readability. ;)
Please contact Technical Support using the telephone icon (the Contact Us button) in the upper-right corner of this page.
per isakson
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!
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.

Sign in to comment.

Categories

Products

Release

R2018b

Asked:

on 5 Apr 2020

Commented:

on 8 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!