matlab - How to use a cell array directly returned from a function? -


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

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -