Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

fileparts version obsolete (error in 2015 versions of MATLAB)

If you have a matlab command line like

[p,f,e,v] = fileparts( filename );

MATLAB will give an error like this:

Error using fileparts
Too many output arguments.

The 4th output argument ("v" in our example) needs to be deleted:

[p,f,e] = fileparts( filename );

FYI: fileparts separates a filename into path (folder), filename, and extension. 

Fixing an error

Follow these steps to fix a fileparts error.

1) Identify the m-file and line number where the problem is. For example, for the following error message

Error using fileparts
Too many output arguments.
                   
Error in ==> wfu_spm at 168           

the file "wfu_spm.m" has the error at line 168.

2) Open this file in the MATLAB editor:

>>edit wfm_spm

3) Go to the line with the problem (168 in our example)

4) Delete the 4th output variable (and the comma before it), as in the example above.

5) Save the file; you can close the editor.

Note that oftentimes there are more than one usage of fileparts in a file or set of programs, so you may need to repeat this correction several times.

GUI/GUIDE slowdown

Use this command to clear memory: java.lang.System.gc()

mex-files

Notes on setting up matlab R2007a/b at mathworks. Note that 32 and 64 bit mex-files are different.

Listbox: coloring individual lines

Here's an example for both background and font:

% list contains entires;
for i = 1:length(list)
    list_colored{i} = sprintf( '<html><DIV bgcolor="yellow"><font color="red">%s</font></DIV></html>', list{i} );
end
set(handles.group,'String',list_colored)

See further info.

Subpages

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.