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:
- Clear the cache and cookies of your browser, then reload MATLAB Online.
- Log in to the following link https://drive.matlab.com/files with your MathWorks Account credentials.
- Click on username to show dropdown and check the box to "Show Hidden Files"
- Rename the "/MATLAB Drive/.session" folder to "/MATLAB Drive/.session-backup"
- Go to https://matlab.mathworks.com and try re-using MATLAB Online.
Hope this helps.