Error using plot()

17 vues (au cours des 30 derniers jours)
Collin Curtis
Collin Curtis le 24 Oct 2021
Modifié(e) : Siraj le 21 Fév 2024
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.

Réponses (1)

Siraj
Siraj le 21 Fév 2024
Modifié(e) : Siraj le 21 Fév 2024
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.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by