How can I automatically assign figure title in doubled for loop

2 次查看(过去 30 天)
Hello, I create a set of plots using following code. Now I would like to automatically assign each figure a title with the variable names of both data sets used to create the figure. Lauf6 and lauf7 refer to column numbers in a table array. Any suggestions?
for lauf7 = [5 6 8 29 30]
for lauf6 = 19:30
figure
scatter(table2array(T(:,lauf7)),table2array(T(:,lauf6)))
xlabel(T.Properties.VariableNames(lauf7))
ylabel(T.Properties.VariableNames(lauf6))
end
end
Thx in advance

采纳的回答

Adam Danz
Adam Danz 2020-2-17
Use sprintf()
Example
for lauf7 = [5 6 8 29 30]
for lauf6 = 19:30
figure('name',sprintf('lauf7_%d_lauf6_%d',lauf7, lauf6))
  3 个评论
Adam Danz
Adam Danz 2020-2-17
The variable name is a string so you'd use the string format spec in sprintf
sprintf('...%s', T.Properties.VariableNames{lauf7})

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Title 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by