MATLAB: Graph tiltle with multiple variables over 2 lines

title with variables multiple lines

I Have been tryint to make the variables contained in this title append over two maybe three lines, following the use of {} brackets. But so far it returns 3 per lines per num2str. Could anyone help point appropriate corrections to obtain 2 maybe three lines.
thanks
title({'Request dur= ' num2str(timeseriesMatPurgeRequest{II}{X}.time(end)),'s, Request Dist = ' num2str(timeseriesMatPurgeRequestvalues(1)),'km', 'NOx eff = ' num2str(((timeseriesMatPurgeRequestvalues(1)-timeseriesMatPurgeRequest{II}{X}.ExM_mStrNOx_ExEle.signals.values(end))/timeseriesMat.values(1))*100) '%, Dilution = ' num2str(((timeseriesMatPurgeRequest.values(1)-timeseriesMatPurgeRequest{II}{X}.elomm_w_fio_out_01.signals.values(end))/timeseriesMatPurge.values(1))*100) '%','AcvRul = ' num2str(timeseriesMatPurgeRequest.values(1)) ', Total Rich Time = ' num2str(sum(mode(diff(timeseries.time))*numel(find(timeseriesMat.values<1)))) 's', 'NOx Remove Rate = ' num2str(((timeseriesMatvalues(1)-timeseriesMat.values(end))/(sum(mode(diff(timeseriesMatPurge.time))*numel(find(timeseriesMat.values<1))))))'})

Best Answer

Franc - try using sprintf to create one or more lines that you can use in your title. For example,
myTitle = sprintf('first row has integer: %d\nsecond row has float: %f\n', 42, pi);
title(myTitle);
Note how you do not have to convert any of your numbers into strings (the '\n' is used to indicate a new line). You may want to use local variables for the calculated values rather than trying to do them all on one line of code. i.e.
totalRichTime = sum(mode(diff(timeseries.time))*numel(find(timeseriesMat.values<1)));
duration = timeseriesMatPurgeRequest{II}{X}.time(end);
myTitle = sprintf('duration = %fs\ntotal rich time = %fs', duration, totalRichTime);
or something similar.
Related Question