Latex interpreter for "Edit field" label in App Designer

17 ビュー (過去 30 日間)
Filippo Ambrosino
Filippo Ambrosino 2021 年 3 月 26 日
編集済み: Mario Malic 2021 年 6 月 9 日
Hi everyone,
I'm currently developing a GUI by using Matlab R2021a App Designer. I need to have an "Edit field" label interpreted with latex whose fontsize should be 14. I alreay set the app.EditFiledLabel.fontsize = 14 property in the TEXT inspector and it works proprly. Unfortunately, every time the app is restared the label fontsize always comes back to 12 without any possibility to be modified. I tried to specify the app.EditFiledLabel.fontsize = 14 property at the startup and in some callbacks with no result.
Did anyone have the same issue? Are there suggentions to solve the problem?
Thank you all.
Filippo
  3 件のコメント
Filippo Ambrosino
Filippo Ambrosino 2021 年 3 月 27 日
編集済み: dpb 2021 年 3 月 28 日
Hi,
the creation code is correct. I append it here below:
app.EccentricityeEditFieldLabel = uilabel(app.OrbitalparametersPanel);
app.EccentricityeEditFieldLabel.Interpreter = 'latex';
app.EccentricityeEditFieldLabel.FontSize = 14;
app.EccentricityeEditFieldLabel.Position = [2 251 124 22];
app.EccentricityeEditFieldLabel.Text = 'Eccentricity (e):';
The problem arises whenever I restart the app because the label fontsize is no longer 14 but 12 indeed. This happens only if I use the latex interpreter.
Cheers,
Filippo
dpb
dpb 2021 年 3 月 27 日
Well, that would then seem to be a bug.
The suggestion in the TMW link I referred to above was that the workaround for lack of LaTeX interpreter would be to generate the string outside and put it into the field externally/manually. This is obviously limited to static text, of course.

サインインしてコメントする。

採用された回答

Mario Malic
Mario Malic 2021 年 3 月 27 日
編集済み: Mario Malic 2021 年 6 月 9 日
Hi Filippo,
It seems like a weird bug, but this code makes it work. If you add drawnow in startupFcn, the FontSize can be changed, but make sure that the font size is different from the number in the component browser, otherwise it won't be changed.
Credits to TMW Customer Service
function startupFcn(app)
drawnow
app.EditFieldLabel.Text= '\[ x^n + y^n = z^n \]';
app.EditFieldLabel.FontSize = 25;
end
  5 件のコメント
Mario Malic
Mario Malic 2021 年 3 月 31 日
編集済み: Mario Malic 2021 年 3 月 31 日
Edit: I have updated the answer.
I guess there are some issues with the App Designer, as I've changed it from outside, using the command window.
I have reported this as a bug, so, probably will be fixed in the next update.
What you can also try is to write a function or a script that finds the app handle and changes the fontsize. Then call the script in StartupFcn. I'll try that later unless you do it first.
Filippo Ambrosino
Filippo Ambrosino 2021 年 4 月 1 日
Hi Mario,
thanks a lot, your workaround is working! However if you use the latex interpreter, I verified that each property of text label is affected by this weird bug (not only the fontsize).
Anyway, many thanks again.
Cheers,
Filippo

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by