I have a path (without a file name at the end) as a string in Matlab and i want to receive the first parent directory (the directory after the last file seperator character) in it.
At the moment i'm doing it like this:
>>filePath = 'D:\TRAIN_DATA\OBSTACLES\DOF';
>>firstParent = strsplit(filePath , filesep);
>>firstParent = firstParent{end};
>>disp(firstParent);
DOF
Is there any way i can use strsplit's return value (a cell array) without assinging it to a variable first?
Something like:
>>filePath = 'D:\TRAIN_DATA\OBSTACLES\DOF';
>>firstParent = ( strsplit(filePath , filesep) ){end};
>>disp(firstParent);
DOF