participant
participant

Reputation: 3003

How to pass a cell array to fullfile

How do I pass a cell array like

pathParts = {'D:', 'foo', 'matic'}

to fullfile to obtain a complete path (i.e. D:\foo\matic)?

Upvotes: 1

Views: 342

Answers (1)

rinkert
rinkert

Reputation: 6863

As follows:

fullfile(pathParts{:})

By colon indexing of a cell array, MATLAB will return a comma separated list. This you can then easily pass to other functions.

Upvotes: 2

Related Questions