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

Walter Roberson
Walter Roberson 2020년 4월 5일
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 2020년 4월 5일
편집: Mehdi Shafiei 2020년 4월 5일
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
Mehdi Shafiei
Mehdi Shafiei 2020년 4월 5일
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.
Mehdi Shafiei
Mehdi Shafiei 2020년 4월 5일
It is clear that Matlab 2018b has problems running its own Example as I sent it by a screenshot!
Image Analyst
Image Analyst 2020년 4월 6일
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
per isakson 2020년 4월 6일
I'm sure I run R2018b and I see the same "Copyright 2012".
Mehdi Shafiei
Mehdi Shafiei 2020년 4월 6일
@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.
per isakson
per isakson 2020년 4월 6일
No problem, see my answer.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2020년 4월 5일

0 개 추천

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

댓글 수: 2

Mehdi Shafiei
Mehdi Shafiei 2020년 4월 5일
It clears up that there shouldn't be a problem with the version.
Good! and thanks!
But where is the problem then?
Walter Roberson
Walter Roberson 2020년 4월 6일
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
per isakson 2020년 4월 6일
편집: per isakson 2020년 4월 6일

0 개 추천

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

Mehdi Shafiei
Mehdi Shafiei 2020년 4월 6일
편집: per isakson 2020년 4월 6일
>> version
ans =
'9.5.0.1298439 (R2018b) Update 7'
K>> dsName, location, varargin{:}
dsName =
'matlab.io.datastore.TabularTextDatastore'
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
per isakson
per isakson 2020년 4월 6일
편집: per isakson 2020년 4월 6일
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
per isakson 2020년 4월 6일
편집: per isakson 2020년 4월 6일
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
Mehdi Shafiei 2020년 4월 6일
편집: per isakson 2020년 4월 6일
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'
Mehdi Shafiei
Mehdi Shafiei 2020년 4월 6일
편집: per isakson 2020년 4월 6일
K>> location, varargin{:}
location =
'airlinesmall.csv'
ans =
'TreatAsMissing'
ans =
'NA'
K>>
per isakson
per isakson 2020년 4월 6일
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
Mehdi Shafiei 2020년 4월 6일
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. ;)
Steven Lord
Steven Lord 2020년 4월 6일
Please contact Technical Support using the telephone icon (the Contact Us button) in the upper-right corner of this page.
Mehdi Shafiei
Mehdi Shafiei 2020년 4월 6일
Got it!
Cheers
per isakson
per isakson 2020년 4월 6일
편집: per isakson 2020년 4월 6일
"[...] 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
Mehdi Shafiei 2020년 4월 7일
v.v
;)
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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품

릴리스

R2018b

질문:

2020년 4월 5일

댓글:

2020년 4월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by