PCOLOR command in Matlab App Designer
14 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Michal Cerny
el 2 de En. de 2022
Comentada: Image Analyst
el 2 de En. de 2022
I have achieved working and running code in Matlab, but I have problem converting it for use in the App Designer. I am mostly struggling with the syntax. For the graph I am using UIAxes in app designer.
the code:
E=[1 1 0 0 1 0;1 1 0 0 1 0;1 1 0 0 1 0;1 1 0 0 1 0;1 1 0 0 1 0;1 1 0 0 1 0;]
grid=pcolor(padarray(E,[1 1],'replicate','post'))
grid.EdgeColor=[0 0 0]
grid.LineWidth=3
colormap(jet(4))
set(gca,'ydir','reverse')
axis equal
Thank you very much for your help
Michal Cerny
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de En. de 2022
Instead of passing the uiaxes as the first parameter, use the 'Parent' name/value pair.
grid = pcolor(padarray(E,[1 1],'replicate','post'), ...
'Parent', app.UIAxes, 'EdgeColor', [0 0 0], 'LineWidth', 3);
colormap(app.UIAxes, jet(4))
app.UIAxes.YDir = 'reverse';
axis(app.UIAxes, 'equal')
2 comentarios
Image Analyst
el 2 de En. de 2022
Try this:
E = rand(5,5); % Just for demo - you should delete this line.
app.UIAxes = axes(); % Just for demo - you should delete this line.
paddedE = padarray(E,[1 1],'replicate','post')
hp = pcolor(paddedE, 'Parent', app.UIAxes);
hp.EdgeColor = [0 0 0];
hp.LineWidth = 3;
colormap(app.UIAxes, jet(4))
app.UIAxes.YDir = 'reverse';
axis(app.UIAxes, 'equal')
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!