- 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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Duncan Carlsmith
el 14 de Oct. de 2025 a las 17:54
Comentada: Cris LaPierre
el 15 de Oct. de 2025 a las 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 comentarios
Respuesta aceptada
Cris LaPierre
el 14 de Oct. de 2025 a las 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 comentarios
Cris LaPierre
el 15 de Oct. de 2025 a las 12:15
For performance issues, please report those directly to MathWorks: https://www.mathworks.com/support/contact_us.html
Más respuestas (0)
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!