- Check that you meet the browser requirements.
- Try a different browser
- Try clearing your cookies and cache
- Try signing out and signing back in. I'd suggest waiting ~15 mins to ensure you get a fresh worker.
MATLAB online video creation trouble
32 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Duncan Carlsmith
am 14 Okt. 2025 um 17:54
Kommentiert: Cris LaPierre
am 15 Okt. 2025 um 12:15
The following test code runs in 3 seconds natively with v2025a but stalls and never completes in MATLAB online. Any suggestion appreciated.
% Quick animation video test (works in MATLAB Online and Desktop)
clear; close all; clc;
tic
% ---- Output file (timestamped) ----
outdir = 'testvideos';
if ~(exist(outdir,'dir')==7), mkdir(outdir); end
ts = char(datetime('now','Format','yyyyMMdd_HHmmss'));
base = fullfile(outdir, ['ball_line_' ts]);
vidfile = [base '.avi'];
vw = VideoWriter(char(vidfile));
vw.FrameRate = 30;
vw.Quality = 90;
open(vw);
% ---- Figure & axes (keep simple for Online) ----
figW = 640; figH = 360; % modest, consistent size
animFig = figure('Color','w','Units','pixels', ...
'Position',[100 100 figW figH], 'Resize','off');
ax = axes('Parent',animFig); hold(ax,'on'); axis(ax,'equal'); axis(ax,'off');
plot(ax, [0 1], [0 0], 'k-', 'LineWidth',2); % the line
xlim(ax,[0 1]); ylim(ax,[-0.2 0.2]);
% ---- Ball (drawn as a filled circle) ----
r = 0.05; y0 = 0;
hBall = rectangle(ax, 'Position',[0.05-r y0-r 2*r 2*r], ...
'Curvature',[1 1], 'FaceColor',[0.20 0.35 0.85], 'EdgeColor','none');
% ---- Simple motion & capture loop ----
duration_sec = 2; % 2-second clip
nframes = duration_sec * vw.FrameRate;
xs = linspace(0.05, 0.95, nframes); % left -> right
for k = 1:nframes
set(hBall, 'Position', [xs(k)-r, y0-r, 2*r, 2*r]);
drawnow('expose'); % ensure the frame is rendered
fr = getframe(animFig); % capture the figure
writeVideo(vw, fr);
end
close(vw);
disp("Wrote video: " + string(vidfile));
toc
0 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 14 Okt. 2025 um 20:04
The code completes successfully for me when I run it. It took 13-15 seconds.
Given that it does run, I'd suggest the typical actions for browser-based tools.
4 Kommentare
Cris LaPierre
am 15 Okt. 2025 um 12:15
For performance issues, please report those directly to MathWorks: https://www.mathworks.com/support/contact_us.html
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
