Have title of plot change IF edit field has text, otherwise default
1 次查看(过去 30 天)
显示 更早的评论
Plots created in my code default the title of the plots to the folder in which the data comes from. Usually this is what is needed, however if the user wanted to change it they could type into an edit field. How do I make the code check for text to use and if not just keep the default.
I have this but it won't change when I type into the edit field.
% Set title font size
if app.GraphTitleEditField == 0;
title(app.GraphTitleEditField.Value,'FontSize',32);
else
title(ParentFolderName,'FontSize',32);
end
0 个评论
采纳的回答
Bora Eryilmaz
2022-12-21
编辑:Bora Eryilmaz
2022-12-21
You are comparing the edit field object itself to 0, instead of the content of the edit field. Try
if ~isempty(app.GraphTitleEditField.Value)
end
You may need char() if the Value is a string, instead of a char array:
if ~isempty(char(app.GraphTitleEditField.Value))
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!