Dynamically label subplots using another array

I am trying to label every subplot in a figure with a different title based on two different columns in another array (in this case 'Labels'). It will read the first part (here 'My Title and') but it will not read anything after that (e.g. '%d',Labels(cc,2) ,Labels(cc,3)). Any help is much appreciated. Thanks!
for cc = 1:length(Labels)
subplot(5,10,cc)
scatter(1:length(X_FinalRMS(1).RMSCh1),X_FinalRMS(cc).RMSCh1);
xlim([0 650]);
ylim([RMSMinCh1 RMSMaxCh1]);
title(sprintf('My Title and','%d',Labels(cc,2) ,Labels(cc,3)));
end

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 15일

0 개 추천

The first argument to sprintf is format specification, and the remaining are the values to create the string. So you should write something like this
sprintf('My Title and %d %d',Labels(cc,2) ,Labels(cc,3))

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Axis Labels에 대해 자세히 알아보기

질문:

SRB
2020년 10월 15일

댓글:

SRB
2020년 10월 15일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by