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
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
2020년 4월 5일
편집: Mehdi Shafiei
2020년 4월 5일
Walter Roberson
2020년 4월 5일
You said:
Line 169 in DataStore.m :
DataStore.m is not the same as datastore.m
Mehdi Shafiei
2020년 4월 5일
Mehdi Shafiei
2020년 4월 5일
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
2020년 4월 6일
I'm sure I run R2018b and I see the same "Copyright 2012".
Mehdi Shafiei
2020년 4월 6일
per isakson
2020년 4월 6일
No problem, see my answer.
답변 (2개)
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
2020년 4월 5일
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
2020년 4월 6일
편집: per isakson
2020년 4월 6일
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
2020년 4월 6일
편집: per isakson
2020년 4월 6일
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
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
2020년 4월 6일
편집: per isakson
2020년 4월 6일
Mehdi Shafiei
2020년 4월 6일
편집: per isakson
2020년 4월 6일
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
2020년 4월 6일
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
2020년 4월 6일
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
2020년 4월 7일
per isakson
2020년 4월 8일
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에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!