matlab - How to use a cell array directly returned from a function? -
this question has answer here:
i have path (without file name @ end) string in matlab , want receive first parent directory (the directory after last file seperator character) in it.
@ moment i'm doing this:
>>filepath = 'd:\train_data\obstacles\dof'; >>firstparent = strsplit(filepath , filesep); >>firstparent = firstparent{end}; >>disp(firstparent); dof
there way can use strsplit's return value (a cell array) without assinging variable first?
like:
>>filepath = 'd:\train_data\obstacles\dof'; >>firstparent = ( strsplit(filepath , filesep) ){end}; >>disp(firstparent); dof
do mean:
[~,firstparent] = fileparts ( 'd:\train_data\obstacles\dof' )
Comments
Post a Comment