readstdtcdata.m is an external m file
error using fopen-- too many input arguments
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i wanted to make a thermocouple database data file in matlab. So i downloaded the tables from the its-90 website and used the following code to acquire and read the data
all.tab is a text doc containing thermocouple data.
tcdata=readstdtcdata('all.tab'); save thermocouple_its90.mat tcdata;
It gives the following error:-
??? Error using ==> fopen Too many input arguments.
Error in ==> readstdtcdata at 89 f = fopen(filename,'r', 'n', 'ISO-8859-1');
So what should i do.Is there any way to counter this issue
Réponse acceptée
dpb
le 8 Fév 2014
Modifié(e) : dpb
le 8 Fév 2014
??? Error using ==> fopen Too many input arguments.
Error in ==> readstdtcdata at 89 f = fopen(filename,'r', 'n', 'ISO-8859-1');
The fourth optional argument to fopen (ENCODING) is a relatively recent introduction; I'm not sure precisely which version of Matlab introduced it. I have R12 and R2012b here; it's not in R12 but is in R2012b so somewhere in between (which is a pretty wide spell, granted).
If you can't upgrade your version, then the only fix is to edit the m-file for readstdtcdata and remove the 'ISO-8859-1' argument. It's highly unlikely you need it anyway.
2 commentaires
dpb
le 8 Fév 2014
Modifié(e) : dpb
le 8 Fév 2014
function tc = readstdtcdata(filename)
%READSTDTCDATA read NIST STD DB 60 ITS-90 thermocouple data file
%
...
tc = [];
% --- Open ITS-90 text/data file
f = fopen(filename,'r', 'n', 'ISO-8859-1');
...
So, you've got it; make an edit and resave it or rename a copy of it to something else and use that instead...
f = fopen(filename,'r', 'n');
Is what you need instead for an earlier version of Matlab.
Or, of course, you could bury a version test in there as well and execute conditionally or a try...catch block--
try
f = fopen(filename,'r', 'n', 'ISO-8859-1');
catch
f = fopen(filename,'r', 'n');
end
It's either that or upgrade or use another tack entirely.
ADDENDUM:
I hadn't noticed it was a TMW-supplied file; interesting. Despite that and the hope that they would have self-consistent Toolboxen with the main release, clearly from the error message your version of base Matlab does not support the fourth (ENCODING) argument to fopen.
What does ver return on your system?
Oh, or another thought -- isn't any chance there's an out-of-date version of fopen hanging around is there? What does
which fopen
return?
ADDENDUM 2:
And, of course, what does
help fopen
show for number of possible arguments? It'll simply be
[FID, MESSAGE] = FOPEN(FILENAME,PERMISSION,MACHINEFORMAT)
as the most number of parameters (from my R12 doc) rather than the
[FID, MESSAGE] = fopen(FILENAME,PERMISSION,MACHINEFORMAT,ENCODING)
in the following (new) paragraph in the R2012b doc's; said section not existing in R12.
Again, there's your apparent problem; the function expects a later version of fopen than your installation.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!