Why won't MATLAB let me open any files, scripts, or anything at all?
Show older comments
If I try opening a file or script by clicking on it from the command window, I get the following error:
Error using fullfile (line 51)
String input not supported.
Error in toolboxdir (line 22)
s=fullfile(matlabroot,'toolbox', tbxdirname);
Error in matlab.ui.internal.dialog.DialogUtils.imreadDefaultIcon (line 38)
iconFileName = fullfile(toolboxdir('matlab'), 'uitools', 'private', ['icon_' iconName '_32.png']);
Error in msgbox>setupStandardIcon (line 438)
[iconData, alphaData] = matlab.ui.internal.dialog.DialogUtils.imreadDefaultIcon(iconName);
Error in msgbox (line 353)
Img = setupStandardIcon(IconAxes, IconString);
Error in errordlg (line 47)
handle = msgbox(ErrorStringCell,DlgName,'error',Replace);
Error in uiopen (line 194)
errordlg(err);
If I try opening a file by using the open command, I get a different error (see below). Either way, I can't open any scripts at all!
Error using which
Arguments must contain a character vector.
Error in finfo (line 60)
openAction = which(['open' ext '(''char'')']);
Error in open (line 114)
[~, openAction] = finfo(fullpath);
Any suggestions? I've been a MATLAB user for 3 years and this has never happened before.
5 Comments
Walter Roberson
on 14 Nov 2017
Could you show us exactly how you are trying to do the open ?
Is it possible that you are getting the file name to open by using uiimport() of a text item?
Noam Nitzan
on 14 Nov 2017
I'm having exactly the same problem but only occasionally, then I have to restart Matlab. Would also like to know how to fix it though, it's pretty annoying. Could it be related to upgrading Matlab? I was using 2012 so far and just upgraded to 2017.
Steven Lord
on 14 Nov 2017
Most of the time when I've seen reports of this type of problem, it occurred because the user created a function with the same name as a MathWorks function but different behavior. If you're only seeing this problem sporadically, it's possible that function is in a directory that is only occasionally on the MATLAB path or is only occasionally your current directory.
The next time you encounter this problem I recommend looking at what's in the current directory and checking (using which) if the function called out in the error message is both a file in that directory and a function included in MATLAB or another MathWorks product.
Walter Roberson
on 14 Nov 2017
You can get those kinds of errors about which and open if you attempt to which() or open() using one of the new string objects instead of a character vector. For example
>> which("polyfit")
Error using which
Arguments must contain a character vector.
One of the ways that you can end up with a string instead of a character vector is if you used uiimport, which in the last couple of releases has defaulted to importing text as string instead of as character vector.
Walter Roberson
on 11 Apr 2018
(R2018a can handle string objects for which())
Answers (2)
Blake Porter
on 20 Feb 2018
0 votes
Opening matlab as administrator fixes this for me. Matlab R2017a
Walter
on 11 Apr 2018
0 votes
The same problem here. I am confident the code is fine because it runs using 2016a but once upgraded to 2017b nothing works.
1 Comment
Walter Roberson
on 11 Apr 2018
As I posted above,
"One of the ways that you can end up with a string instead of a character vector is if you used uiimport, which in the last couple of releases has defaulted to importing text as string instead of as character vector."
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!