Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents

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, along with the preceding comma:

[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 where ",v" was removed.

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

Child pages (Children Display)