Error using plot()

4 ビュー (過去 30 日間)
Collin Curtis
Collin Curtis 2021 年 10 月 24 日
編集済み: Siraj 2024 年 2 月 21 日
Get this error when trying to use the plot() function on MATLAB online. I tried refreshing the page, and closing and reopening the website. Error does not seem to be attached to my code. I tried a number of different plots. This may be unrelated but it will also not allow me to close the figure 1 tab. Plot was working before.

回答 (1 件)

Siraj
Siraj 2024 年 2 月 21 日
編集済み: Siraj 2024 年 2 月 21 日
Hi!
I understand that you're encountering an issue when trying to use the "plot" function in MATLAB Online. Based on the error message you've encountered, it seems that the problem may not be related to your code. I've tested the "plot" function with some sample code on my end, and it appears to be working correctly. Since you haven't provided the "dataset1.mat" file you are using, pinpointing the exact cause of the error is challenging.
Try running the following sample code to see if the error still occurs:
x = linspace(0, 2*pi, 1000); % 1000 points between 0 and 2*pi
% Define the function to be plotted (sine function in this case)
y = sin(x);
% Create the plot
figure; % Creates a new figure window
plot(x, y, 'b-', 'LineWidth', 2); % Plots the sine wave with a blue line
title('Sine Wave Plot');
xlabel('x (radians)');
ylabel('sin(x)');
If this sample code executes without any errors, there could be an issue with the "dataset1.mat" file.
Additionally check if there’s some other script or function that is shadowing the “plot” function. To do so, you can execute the following command in the Command Window.
which -all plot
This will reveal if any other scripts or functions are overshadowing the "plot" function.
If the “plot” function is not overshadowed but the issue persists here are a few steps you can try:
  1. Clear the cache and cookies of your browser, then reload MATLAB Online.
  2. Log in to the following link https://drive.matlab.com/files with your MathWorks Account credentials.
  3. Click on username to show dropdown and check the box to "Show Hidden Files"
  4. Rename the "/MATLAB Drive/.session" folder to "/MATLAB Drive/.session-backup"
  5. Go to https://matlab.mathworks.com and try re-using MATLAB Online.
Hope this helps.

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by