Graph tiltle with multiple variables over 2 lines
3 ビュー (過去 30 日間)
古いコメントを表示
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))))))'})
0 件のコメント
採用された回答
Geoff Hayes
2019 年 4 月 27 日
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.
9 件のコメント
Walter Roberson
2019 年 4 月 28 日
With the (end) indexing at the end of timeseriesMatPurgeRequest etc., then Requestdur would have to be a scalar. If II was non-scalar or X is non scalar or ATSys_noATSysRgnReq is a non-scalar structure, then you would have received a runtime error about attempting to index improperly. The only way you could get Requestdur as a vector there without significant changes to the code is if you omitted the (end) indexing.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!