Function not plotting on the app version

Whenever I run this code in the app on my laptop, the figure is blank and the function is not plotted. However, whenever I run this code on the web version of Matlab it actually plots the function. I have already uninstalled and reinstalled the app two times, so I was wondering if there is anything else that I am missing.
%%
x = linspace(0, 2*pi, 100);
y = 10 + sin(x);
figure(1);
plot(x, y);
xlabel('x');
ylabel('f(x)');
title('Plot of f(x) = 10 + sin(x)');
xlim([0, 2*pi]);
ylim([8, 12]);

回答 (1 件)

Image Analyst
Image Analyst 2024 年 1 月 30 日

0 投票

It should work. If you look in the workspace panel, are there variables listed there?
If you have any more questions, then attach your data and code to read it (your m-file or mlapp file) in with the paperclip icon after you read this:

3 件のコメント

Trevor Cline
Trevor Cline 2024 年 1 月 30 日
Thank you for the quick response. Yes there are variables present in the workspace panel. However, it just doesn't work in my app. The code is the exact same but for some reason it just does not plot and the figure is blank.
VBBV
VBBV 2024 年 1 月 31 日
Try uninstalling the app and re-install it. Then run the code again.
Image Analyst
Image Analyst 2024 年 1 月 31 日
It runs fine for me in R2023b. When you say "app" do you mean that you run the m-file script in the MATLAB development environment, or do you mean that you used the MATLAB Compiler toolbox to compile your script into a standalone executable?

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

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2023b

タグ

質問済み:

2024 年 1 月 30 日

コメント済み:

2024 年 1 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by