Azzera filtri
Azzera filtri

error using fopen-- too many input arguments

4 visualizzazioni (ultimi 30 giorni)
Kartik
Kartik il 8 Feb 2014
Modificato: dpb il 8 Feb 2014
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

Risposta accettata

dpb
dpb il 8 Feb 2014
Modificato: dpb il 8 Feb 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 Commenti
Kartik
Kartik il 8 Feb 2014
readstdcdata is an external m file
dpb
dpb il 8 Feb 2014
Modificato: dpb il 8 Feb 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Holidays / Seasons in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by