Filter löschen
Filter löschen

Error Message "'This package uses the Matlab command xlsread to read from Excel files...." Matlab 6/Matlab 7

35 Ansichten (letzte 30 Tage)
Dear all,
when I'm running the file DSGEFig1.m a window pops up, asking for "Specify Excel: Enter the name of the Excel input file". Now the problem is that when I enter the excel file and click OK, I get the following error message:
'This package uses the Matlab command xlsread to read from Excel files.',...
'This command appeared for the first time in Matlab 6. Your version of Matlab is older than version 6.',...
'You must modify the file DSGEReadExcel to read in data etc in some other way. Or upgrade Matlab ...'
I use the Matlab version 2023b.
I've read a previous post that one can try
which -all xlsread
and check for third party toolboxes and support packages. However, when I enter this code line, I get
/Applications/MATLAB_R2023b.app/toolbox/matlab/iofun/xlsread.m
As I see it, third party toolboxes and support packages are not the problem in my case.
I tried to change the code in DSGEReadExcel from xlsread to readtable and readmatrix but I still get the same error message.
Can someone help me and tell me, how I can solve the problem?
Many thanks for your help!
  4 Kommentare
dpb
dpb am 5 Jul. 2024 um 12:29
I had just come back to add @Torsten's suggestion to my earlier response -- just don't try to test for the release at all and xlsread (while having gone through an entire life cycle by now being deprecated rather than predating the release) should work just fine presuming the spreadsheet input form is within the expectations of the package. This must be a very old piece of work, but that alone doesn't mean it isn't good; there's FORTRAN code from the 50s and 60s still in active use...
Andreas Goser
Andreas Goser am 5 Jul. 2024 um 13:48
As there are holidays in the US, you may want to wait a bit if other attempts to help come in next week. Here my 2 €cts:
Your path suggests your installation is not on Windows. Let me guess it is Linux. If I recall it correctly, historically XLSREAD needed an installation of Microsoft Excel and there was an AxtiveX communication to read the data. As there was no Microsoft products on Mac and Linux during those days (not entirely sure how it is today), this was a limitation of using code across platforms which was one of probably mutlple reasons to find a different approach.
With that in mind, I wonder what your overall workflow is. The Excel files come from somewhere. Like you or a project partner measure someting and store it in Excel format and then you are tasked to do post-processing. Could this be changed easily so it is stored in a different format? Or even use the Data Acquistion Tbx to make the measurements in it is in MATLAB right away?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Oliver Jaehrig
Oliver Jaehrig am 5 Jul. 2024 um 14:38
As the others already suggested:
Please try to use the debugger and step through the code and see where the check is happening which causes this message to appear. There are also maybe simpler things to try then stepping through it (for example if it is an error message, you can use:
dbstop if error
to stop when the error occurs and then see in the debugger where you are coming from.
Then you simply would need to fix this bug in the code by commenting out the check or replacing the check by using a different algorithm (likely not needed).
If you need any further help, please share the code with us which causes this issue, or let us know if anything written here is unclear.

Weitere Antworten (0)

Kategorien

Mehr zu Data Export to MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by