Error using readcell ...Input must be a row vector of characters or string scalar.

Hi,
I am getting this error when calling readcell:
>> direct = readcell('Scopus.xlsx'); %Scopus.xlsx is a spreadsheet in the current directory.
Error using readcell (line 140)
Input must be a row vector of characters or string scalar.
To make sure that it is not a coding problem, I exectuted the live script example from readcell documentation and I get the same error:
Advice will be appreciated.
Leon

5 Comments

Which MATLAB release are you using? What is the output of
which readcell -all
Start with
clear readcell
altho looks like the error is with the actual routine not an alias -- if that doesn't, then
rehash(matlabroot)
Thanks for the suggestions.
I am using MATLAB Version: 9.6.0.1114505 (R2019a) Update 2 on Windows 10 64 bit OS
The answer to the which -all is:
C:\Program Files\MATLAB\R2019a\toolbox\matlab\iofun\readcell.m
C:\Program Files\MATLAB\R2019a\toolbox\shared\io\+matlab\+io\@ImportOptions\ImportOptions.m % matlab.io.ImportOptions method
I also tried the rehash per @dbp suggestion. Just rehash didn't help and rehash(matlabroot) returns an error that matlabroot is not a valid option for rehash.
"matlabroot is not a valid option for rehash. "
That's cuz you didn't use the functional form as I showed but command syntax instead-- matlabroot is a builtin function that returns the root folder of the installation; rehash needs the path, not an option argument.
That said, it's probably not going to solve the problem anyway.
Is the a new install and symptom from beginning or something that has shown up recently and (as far as you know, anyway) used to work?
If a shutdown/restart of MATLAB doesn't make it go away, try a reboot. If that doesn't, a reinstall is probably in order.
I actually used teh functional form just as you suggsted dbp
>> rehash(matlabroot)
Error using rehash
No such rehash option
matlabroot on its own indeed returns the path:
>> matlabroot
ans =
'C:\Program Files\MATLAB\R2019a'

Sign in to comment.

Answers (1)

This error is thrown inside the try-catch block. So we can't see what is causing the error, but the most common reason is that you have created a custom-function which is named the same as MATLAB's built-in function. The following procedure will help you spot the file.
1. Run the following line in command window
dbstop if caught error
2. Run your code again. It will automatically pause at the line which is causing the error.
3. Note the name of the file in which the debugger paused.
4. If it is a file which you created, or installed by some external toolbox, i.e., not a part of a MATLAB's toolboxes, then either rename it or remove it from MATLAB path.
5. Run following line to restore debugger to previous state
dbclear if caught error

3 Comments

But OP already told us that
The answer to the which -all is:
C:\Program Files\MATLAB\R2019a\toolbox\matlab\iofun\readcell.m
C:\Program Files\MATLAB\R2019a\toolbox\shared\io\+matlab\+io\@ImportOptions\ImportOptions.m % matlab.io.ImportOptions method
which indicates no aliasing does exist.
In this case, error will be caused because of some functions being internally called by readcell(). For example same happened with this OP: https://www.mathworks.com/matlabcentral/answers/663603-readmatrix-not-enough-input-arguments
Thanks for your help. I tracked the problem to an outdated 'fileparts.m' file that was high on my path.

Sign in to comment.

Products

Tags

Asked:

on 5 Dec 2020

Commented:

on 11 Dec 2020

Community Treasure Hunt

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

Start Hunting!