Hi! I have a array of strings: I want to find prefix and postfix; after find postfix I want to find prefix and postfix of it and so on.
Examplestrings prefix postfix ---> prefix postfix ---> prefix postfix ---> prefix postfix23414 2 3414 3 414 4 14 1 4342(1) 3 42(1) 4 2(1) 2 (1) 134 3 4 4 231 2 31 3 1 1
I have tried to do it with this code:
semanticTrajCompact(1,4).TrajCompact=(semanticTrajCompact(1,4).TrajCompact(~cellfun('isempty',semanticTrajCompact(1,4).TrajCompact)));semanticTrajCompact(1,4).TrajCompact=sort(semanticTrajCompact(1,4).TrajCompact);for k=1:size(semanticTrajCompact(1,4).TrajCompact,1) if ~isempty(semanticTrajCompact(1,4).TrajCompact{k,1}) if semanticTrajCompact(1,4).TrajCompact{k,1}(1)=='(' PrefixPostfix(1,4).prefix{k,1}=semanticTrajCompact(1,4).TrajCompact{k,1}(2:3); PrefixPostfix(1,4).postfix{k,1}=semanticTrajCompact(1,4).TrajCompact{k,1}(5:end); else PrefixPostfix(1,4).prefix{k,1}=semanticTrajCompact(1,4).TrajCompact{k,1}(1); PrefixPostfix(1,4).postfix{k,1}=semanticTrajCompact(1,4).TrajCompact{k,1}(2:end); end endendprefixTree(1,4).prefixTree(:,1)=semanticTrajCompact(1,4).TrajCompact;prefixTree(1,4).prefixTree(:,2)=PrefixPostfix(1,4).prefix;prefixTree(1,4).prefixTree(:,3)=PrefixPostfix(1,4).postfix;
After I have a problems to find prefix and postfix to leave from the result of
prefixTree(1,4).prefixTree(:,3)=PrefixPostfix(1,4).postfix;
Can you help me?
Best Answer