MATLAB: Handle character minus character characterscommalistminusseparated I have two characters which contain '18:29:42.835' and '18:29:49.425'. How is it possible to subtrack t2-t1 so as to find duration? Best Answer f = @(x) str2double(regexp(x,':','split'));t1 = num2cell(f(t1)); % where t1 & 2 are your char arrayst2 = num2cell(f(t2));Wanted = duration(t2{:})-duration(t1{:}) Related SolutionsMATLAB: How to solve this matrix using inverse function Assuming inv(A) is a typo and you really meant inv(AA):"a" and "e" are the same, so you have two rows in AA that are the same. This linear dependency creates a singular matrix AA. MATLAB: Converting cells to strings variantdc = struct2cell(data);t1 = cell2mat(cellfun(@(x)[ischar(x) isnumeric(x)],dc,'UniformOutput', false));celstr = dc(t1(:,1));num = dc(t1(:,2));% if there is a field with a cell with characters and numberst2 = ~any(t1,2);dcc = cell(cellfun(@(x)x(:)',dc(t2),'UniformOutput', false));dcc2 = [dcc{:}];t3 = cell2mat(cellfun(@(x)[ischar(x) isnumeric(x)],dcc2,'UniformOutput', false)')';celstr = [celstr;dcc2(t3(1,:))'];num = [num;dcc2(t3(2,:))']; Related QuestionTime vector to generate a sinusoid signal with 0.5 seconds duration , Fs =200Fill the color in the plotFrequency response of discrete PT1Datahex = sprintf(‘%02x’, T1)?Issue with data format when using textscan()
Best Answer