File Exchange

image thumbnail

UFget: MATLAB interface to the UF sparse matrix collection

version 1.1 (253 KB) by Tim Davis
Downloads sparse matrices from the web directly into the MATLAB workspace, from a vast range of real


Updated 20 Nov 2014

View License

UFget is a MATLAB interface to 2650 sparse matrices (as of Nov 2014) for a wide range of applications, in the UF sparse matrix collection (
Problem = UFget ('HB/arc130'), for example, downloads the matrix of that name. An index is available, making it simple to write an M-file that (for example), downloads all symmetric positive definite matrices one at a time, sorted by the number of nonzeros in the Cholesky factorization after a minimum degree (AMD) ordering.

UFweb ('HB/arc130') opens the web page for the same matrix.

NOTE: tested on 32-bit and 64-bit Linux, and 32bit Windows. Untested on Windows64; if you try it there, please let me know how it works. It should be fine.

MATLAB 7.0 or later is required because of the MAT-file format the matrices are stored in.

Cite As

Tim Davis (2019). UFget: MATLAB interface to the UF sparse matrix collection (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

This package has always worked wonderfully for me in the past but now there is a small problem. The function urlwrite used within UFget on line 194 is now returning an erroneous output. This might be because urlwrite is being superseded by websave. Swapping the snippet of code:

tmp = tempname ; % download to a temp file first
urlwrite (maturl, tmp) ;
movefile (tmp, matfile, 'f') ; % move the new matrix into place

for the code:

websave(matfile, maturl)

fixes the problem for me.

Nick Higham



Convert to a toolbox. Major update: added stand-alone Java interface, and many additional statistics and features.

Added UFgrep('refresh') option. Better error handling when internet connection is down.

Updated matrix index (now 1877 matrices)

Minor m-file help cleanup. Tested on 64-bit MATLAB.

Reposting because code metrics were not updated correctly on The MathWorks web page (no changes to files).

Minor m-lint cleanup.

Simplified UFget; uses urlwrite instead of my own Java code, to download the matrices.

Added UFgrep function. Updated UFget and UFweb.

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: COHSS