Author: PuTI
Why is it showing “Incorrect” for a Task in “Create Animated Plots with MATLAB” course?
I was doing this task in the new "Create Animated Plots with MATLAB" course. But whenever I ran the code, it showed Incorrect. On closer inspection, I saw that when I ran it manually, the animation ran till x = 7.1 but when the code is executed on clicking "Submit", the animation runs till x is a little less than 7. Why is this happening and how can I complete this task?
Code:
for idx = 1:numel(y)
scatter(x(idx),y(idx),40,’filled’)
drawnow
end
Screenshot:I was doing this task in the new "Create Animated Plots with MATLAB" course. But whenever I ran the code, it showed Incorrect. On closer inspection, I saw that when I ran it manually, the animation ran till x = 7.1 but when the code is executed on clicking "Submit", the animation runs till x is a little less than 7. Why is this happening and how can I complete this task?
Code:
for idx = 1:numel(y)
scatter(x(idx),y(idx),40,’filled’)
drawnow
end
Screenshot: I was doing this task in the new "Create Animated Plots with MATLAB" course. But whenever I ran the code, it showed Incorrect. On closer inspection, I saw that when I ran it manually, the animation ran till x = 7.1 but when the code is executed on clicking "Submit", the animation runs till x is a little less than 7. Why is this happening and how can I complete this task?
Code:
for idx = 1:numel(y)
scatter(x(idx),y(idx),40,’filled’)
drawnow
end
Screenshot: animation, plot, drawnow, self-paced online courses MATLAB Answers — New Questions
Why am I unable to install R2026a or newer on my macOS Intel?
I have a license to install the latest release of MATLAB but on the MathWorks Downloads page, the MathWorks Product Installer for Intel Processor is not available for R2026a. Why am I unable to install MATLAB on my macOS Intel?I have a license to install the latest release of MATLAB but on the MathWorks Downloads page, the MathWorks Product Installer for Intel Processor is not available for R2026a. Why am I unable to install MATLAB on my macOS Intel? I have a license to install the latest release of MATLAB but on the MathWorks Downloads page, the MathWorks Product Installer for Intel Processor is not available for R2026a. Why am I unable to install MATLAB on my macOS Intel? MATLAB Answers — New Questions
Create random points in a rectangular domain, but with minimum separation distance
Hello,
I am not a regular user of this program. Hence this query.
I am interested to create random points in a 2D rectangular space, to start with, a uniform distribution. I know how to do this. However, I want to ensure that each of these points are separated by a certain minimum distance.
Can anyone help me with the script please.
Thank you.
SureshHello,
I am not a regular user of this program. Hence this query.
I am interested to create random points in a 2D rectangular space, to start with, a uniform distribution. I know how to do this. However, I want to ensure that each of these points are separated by a certain minimum distance.
Can anyone help me with the script please.
Thank you.
Suresh Hello,
I am not a regular user of this program. Hence this query.
I am interested to create random points in a 2D rectangular space, to start with, a uniform distribution. I know how to do this. However, I want to ensure that each of these points are separated by a certain minimum distance.
Can anyone help me with the script please.
Thank you.
Suresh random points, 2d space, minimum separation distance MATLAB Answers — New Questions
Why is the LAPLACE command in the Symbolic Toolbox able to handle ABS(t+1) but unable to process ABS(t-1)?
I am using the following commands:
syms t s
laplace(abs(t))
ans =
1/s^2
laplace(abs(t+1))
ans =
1/s^2+1/s
laplace(abs(t-1))
ans =
laplace(abs(t-1),t,s)I am using the following commands:
syms t s
laplace(abs(t))
ans =
1/s^2
laplace(abs(t+1))
ans =
1/s^2+1/s
laplace(abs(t-1))
ans =
laplace(abs(t-1),t,s) I am using the following commands:
syms t s
laplace(abs(t))
ans =
1/s^2
laplace(abs(t+1))
ans =
1/s^2+1/s
laplace(abs(t-1))
ans =
laplace(abs(t-1),t,s) laplace, symbolic, absolute MATLAB Answers — New Questions
On ramp wont work
I have Matlab and have logged in using my mathworks acc. but when I try to access onramp to learn how to use Matlab it says "there are no MATLAB resources available". I’m not sure what to do. It keeps retrying every 5-10 seconds or so, but to no avail.I have Matlab and have logged in using my mathworks acc. but when I try to access onramp to learn how to use Matlab it says "there are no MATLAB resources available". I’m not sure what to do. It keeps retrying every 5-10 seconds or so, but to no avail. I have Matlab and have logged in using my mathworks acc. but when I try to access onramp to learn how to use Matlab it says "there are no MATLAB resources available". I’m not sure what to do. It keeps retrying every 5-10 seconds or so, but to no avail. onramp, tutorials, courses, online_training, distance_learning MATLAB Answers — New Questions
When using eigen faces to reconstruct images final image comes out fuzzy even when using all eigen faces
I am trying to reconstruct these images using eigen faces but keep having the same issue.
clear all, close all, clc
r1 = im2double(im2gray(imread(‘r1-168×192.png’)),’indexed’);
r2 = im2double(im2gray(imread(‘r2-168×192.jpg’)),’indexed’);
r3 = im2double(im2gray(imread(‘r3-168×192.jpg’)),’indexed’);
r4 = im2double(im2gray(imread(‘r4-168×192.jpg’)),’indexed’);
r5 = im2double(im2gray(imread(‘r5-168×192.jpg’)),’indexed’);
r6 = im2double(im2gray(imread(‘r6-168×192.jpg’)),’indexed’);
r7 = im2double(im2gray(imread(‘r7-168×192.jpg’)),’indexed’);
r8 = im2double(im2gray(imread(‘r8-168×192.jpg’)),’indexed’);
r9 = im2double(im2gray(imread(‘r9-168×192.jpg’)),’indexed’);
r10 = im2double(im2gray(imread(‘r10-168×192.jpg’)),’indexed’);
m1 = im2double(rgb2gray(imread(‘m1-168×192.jpg’)),’indexed’);
m2 = im2double(im2gray(imread(‘m2-168×192.jpg’)),’indexed’);
m3 = im2double(im2gray(imread(‘m3-168×192.jpg’)),’indexed’);
m4 = im2double(im2gray(imread(‘m4-168×192.jpg’)),’indexed’);
m5 = im2double(im2gray(imread(‘m5-168×192.jpg’)),’indexed’);
m6 = im2double(im2gray(imread(‘m6-168×192.jpg’)),’indexed’);
m7 = im2double(im2gray(imread(‘m7-168×192.jpg’)),’indexed’);
m8 = im2double(im2gray(imread(‘m8-168×192.jpg’)),’indexed’);
m9 = im2double(im2gray(imread(‘m9-168×192.jpg’)),’indexed’);
m10 = im2double(im2gray(imread(‘m10-168×192.jpg’)),’indexed’);
load allFaces.mat % Load data file of faces
r1 = reshape(r1,32256,1);
r2 = reshape(r2,32256,1);
r3 = reshape(r3,32256,1);
r4 = reshape(r4,32256,1);
r5 = reshape(r5,32256,1);
r6 = reshape(r6,32256,1);
r7 = reshape(r7,32256,1);
r8 = reshape(r8,32256,1);
r9 = reshape(r9,32256,1);
r10 = reshape(r10,32256,1);
m1 = reshape(m1,32256,1);
m2 = reshape(m2,32256,1);
m3 = reshape(m3,32256,1);
m4 = reshape(m4,32256,1);
m5 = reshape(m5,32256,1);
m6 = reshape(m6,32256,1);
m7 = reshape(m7,32256,1);
m8 = reshape(m8,32256,1);
m9 = reshape(m9,32256,1);
m10 = reshape(m10,32256,1);
Mfaces = [r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10];
%% Use the first 36 people for training data
trainingFaces = faces(:,1:sum(nfaces(1:38)));
avgFace = mean(trainingFaces,2); % size n*m by 1;
% compute eigenfaces on mean-subtracted training data
X = trainingFaces-avgFace*ones(1,size(trainingFaces,2));
[U,S,V] = svd(X,’econ’);
figure(3) % Open new figure to plot average face
axes(‘position’,[0 0 1 1]), axis off
imagesc(reshape(avgFace,n,m)), colormap gray
im = m6;
figure(6) % Open new figure to plot reconstructed image
subplot(2,4,1), imagesc(reshape(im,n,m)), colormap gray
title(‘Person #37 Original’)
%% Plot first 64 eigenfaces
count = 1;
testFaceMS = im – avgFace ;
for r=[400 800 2282] % Error in original code; 50 not 0 between 25 and 100
count=count+1;
subplot(2,4,count)
reconFace = avgFace + (U(:,1:r)*(U(:,1:r)’*testFaceMS));
imagesc(reshape(reconFace,n,m)), colormap gray % Plot reconstructed face
title([‘r=’,num2str(r,’%d’)]);
pause(0.1)
endI am trying to reconstruct these images using eigen faces but keep having the same issue.
clear all, close all, clc
r1 = im2double(im2gray(imread(‘r1-168×192.png’)),’indexed’);
r2 = im2double(im2gray(imread(‘r2-168×192.jpg’)),’indexed’);
r3 = im2double(im2gray(imread(‘r3-168×192.jpg’)),’indexed’);
r4 = im2double(im2gray(imread(‘r4-168×192.jpg’)),’indexed’);
r5 = im2double(im2gray(imread(‘r5-168×192.jpg’)),’indexed’);
r6 = im2double(im2gray(imread(‘r6-168×192.jpg’)),’indexed’);
r7 = im2double(im2gray(imread(‘r7-168×192.jpg’)),’indexed’);
r8 = im2double(im2gray(imread(‘r8-168×192.jpg’)),’indexed’);
r9 = im2double(im2gray(imread(‘r9-168×192.jpg’)),’indexed’);
r10 = im2double(im2gray(imread(‘r10-168×192.jpg’)),’indexed’);
m1 = im2double(rgb2gray(imread(‘m1-168×192.jpg’)),’indexed’);
m2 = im2double(im2gray(imread(‘m2-168×192.jpg’)),’indexed’);
m3 = im2double(im2gray(imread(‘m3-168×192.jpg’)),’indexed’);
m4 = im2double(im2gray(imread(‘m4-168×192.jpg’)),’indexed’);
m5 = im2double(im2gray(imread(‘m5-168×192.jpg’)),’indexed’);
m6 = im2double(im2gray(imread(‘m6-168×192.jpg’)),’indexed’);
m7 = im2double(im2gray(imread(‘m7-168×192.jpg’)),’indexed’);
m8 = im2double(im2gray(imread(‘m8-168×192.jpg’)),’indexed’);
m9 = im2double(im2gray(imread(‘m9-168×192.jpg’)),’indexed’);
m10 = im2double(im2gray(imread(‘m10-168×192.jpg’)),’indexed’);
load allFaces.mat % Load data file of faces
r1 = reshape(r1,32256,1);
r2 = reshape(r2,32256,1);
r3 = reshape(r3,32256,1);
r4 = reshape(r4,32256,1);
r5 = reshape(r5,32256,1);
r6 = reshape(r6,32256,1);
r7 = reshape(r7,32256,1);
r8 = reshape(r8,32256,1);
r9 = reshape(r9,32256,1);
r10 = reshape(r10,32256,1);
m1 = reshape(m1,32256,1);
m2 = reshape(m2,32256,1);
m3 = reshape(m3,32256,1);
m4 = reshape(m4,32256,1);
m5 = reshape(m5,32256,1);
m6 = reshape(m6,32256,1);
m7 = reshape(m7,32256,1);
m8 = reshape(m8,32256,1);
m9 = reshape(m9,32256,1);
m10 = reshape(m10,32256,1);
Mfaces = [r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10];
%% Use the first 36 people for training data
trainingFaces = faces(:,1:sum(nfaces(1:38)));
avgFace = mean(trainingFaces,2); % size n*m by 1;
% compute eigenfaces on mean-subtracted training data
X = trainingFaces-avgFace*ones(1,size(trainingFaces,2));
[U,S,V] = svd(X,’econ’);
figure(3) % Open new figure to plot average face
axes(‘position’,[0 0 1 1]), axis off
imagesc(reshape(avgFace,n,m)), colormap gray
im = m6;
figure(6) % Open new figure to plot reconstructed image
subplot(2,4,1), imagesc(reshape(im,n,m)), colormap gray
title(‘Person #37 Original’)
%% Plot first 64 eigenfaces
count = 1;
testFaceMS = im – avgFace ;
for r=[400 800 2282] % Error in original code; 50 not 0 between 25 and 100
count=count+1;
subplot(2,4,count)
reconFace = avgFace + (U(:,1:r)*(U(:,1:r)’*testFaceMS));
imagesc(reshape(reconFace,n,m)), colormap gray % Plot reconstructed face
title([‘r=’,num2str(r,’%d’)]);
pause(0.1)
end I am trying to reconstruct these images using eigen faces but keep having the same issue.
clear all, close all, clc
r1 = im2double(im2gray(imread(‘r1-168×192.png’)),’indexed’);
r2 = im2double(im2gray(imread(‘r2-168×192.jpg’)),’indexed’);
r3 = im2double(im2gray(imread(‘r3-168×192.jpg’)),’indexed’);
r4 = im2double(im2gray(imread(‘r4-168×192.jpg’)),’indexed’);
r5 = im2double(im2gray(imread(‘r5-168×192.jpg’)),’indexed’);
r6 = im2double(im2gray(imread(‘r6-168×192.jpg’)),’indexed’);
r7 = im2double(im2gray(imread(‘r7-168×192.jpg’)),’indexed’);
r8 = im2double(im2gray(imread(‘r8-168×192.jpg’)),’indexed’);
r9 = im2double(im2gray(imread(‘r9-168×192.jpg’)),’indexed’);
r10 = im2double(im2gray(imread(‘r10-168×192.jpg’)),’indexed’);
m1 = im2double(rgb2gray(imread(‘m1-168×192.jpg’)),’indexed’);
m2 = im2double(im2gray(imread(‘m2-168×192.jpg’)),’indexed’);
m3 = im2double(im2gray(imread(‘m3-168×192.jpg’)),’indexed’);
m4 = im2double(im2gray(imread(‘m4-168×192.jpg’)),’indexed’);
m5 = im2double(im2gray(imread(‘m5-168×192.jpg’)),’indexed’);
m6 = im2double(im2gray(imread(‘m6-168×192.jpg’)),’indexed’);
m7 = im2double(im2gray(imread(‘m7-168×192.jpg’)),’indexed’);
m8 = im2double(im2gray(imread(‘m8-168×192.jpg’)),’indexed’);
m9 = im2double(im2gray(imread(‘m9-168×192.jpg’)),’indexed’);
m10 = im2double(im2gray(imread(‘m10-168×192.jpg’)),’indexed’);
load allFaces.mat % Load data file of faces
r1 = reshape(r1,32256,1);
r2 = reshape(r2,32256,1);
r3 = reshape(r3,32256,1);
r4 = reshape(r4,32256,1);
r5 = reshape(r5,32256,1);
r6 = reshape(r6,32256,1);
r7 = reshape(r7,32256,1);
r8 = reshape(r8,32256,1);
r9 = reshape(r9,32256,1);
r10 = reshape(r10,32256,1);
m1 = reshape(m1,32256,1);
m2 = reshape(m2,32256,1);
m3 = reshape(m3,32256,1);
m4 = reshape(m4,32256,1);
m5 = reshape(m5,32256,1);
m6 = reshape(m6,32256,1);
m7 = reshape(m7,32256,1);
m8 = reshape(m8,32256,1);
m9 = reshape(m9,32256,1);
m10 = reshape(m10,32256,1);
Mfaces = [r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 m1 m2 m3 m4 m5 m6 m7 m8 m9 m10];
%% Use the first 36 people for training data
trainingFaces = faces(:,1:sum(nfaces(1:38)));
avgFace = mean(trainingFaces,2); % size n*m by 1;
% compute eigenfaces on mean-subtracted training data
X = trainingFaces-avgFace*ones(1,size(trainingFaces,2));
[U,S,V] = svd(X,’econ’);
figure(3) % Open new figure to plot average face
axes(‘position’,[0 0 1 1]), axis off
imagesc(reshape(avgFace,n,m)), colormap gray
im = m6;
figure(6) % Open new figure to plot reconstructed image
subplot(2,4,1), imagesc(reshape(im,n,m)), colormap gray
title(‘Person #37 Original’)
%% Plot first 64 eigenfaces
count = 1;
testFaceMS = im – avgFace ;
for r=[400 800 2282] % Error in original code; 50 not 0 between 25 and 100
count=count+1;
subplot(2,4,count)
reconFace = avgFace + (U(:,1:r)*(U(:,1:r)’*testFaceMS));
imagesc(reshape(reconFace,n,m)), colormap gray % Plot reconstructed face
title([‘r=’,num2str(r,’%d’)]);
pause(0.1)
end image processing MATLAB Answers — New Questions
download link for MATLAB R2012b full version
can you please provide me the link for MATLAB R2012b full version. each time i try to download, it says tat i need to be associated with a license. i give my license number and product activation key. but it is showing error. it asks to give (-) in the activation key where i am providing (-) in between the key. but still not working. so i thought there might be some other link for downloading the full version software. please let me know about the linkcan you please provide me the link for MATLAB R2012b full version. each time i try to download, it says tat i need to be associated with a license. i give my license number and product activation key. but it is showing error. it asks to give (-) in the activation key where i am providing (-) in between the key. but still not working. so i thought there might be some other link for downloading the full version software. please let me know about the link can you please provide me the link for MATLAB R2012b full version. each time i try to download, it says tat i need to be associated with a license. i give my license number and product activation key. but it is showing error. it asks to give (-) in the activation key where i am providing (-) in between the key. but still not working. so i thought there might be some other link for downloading the full version software. please let me know about the link downloading, matlab r2012b, full version, activation key, license MATLAB Answers — New Questions
Unable to set breakpoint
Every time I try to set a breakpoint, the red circle comes up as long as I keep ‘holding’ the click, but then when I ‘release’ the click, it goes away. I used to be able to set breakpoints normally but now I can’tEvery time I try to set a breakpoint, the red circle comes up as long as I keep ‘holding’ the click, but then when I ‘release’ the click, it goes away. I used to be able to set breakpoints normally but now I can’t Every time I try to set a breakpoint, the red circle comes up as long as I keep ‘holding’ the click, but then when I ‘release’ the click, it goes away. I used to be able to set breakpoints normally but now I can’t breakpoint, technical MATLAB Answers — New Questions
Mathwork Licensing Error 5005
Post Content Post Content erroe 5005 MATLAB Answers — New Questions
Is there a way to insert a common ylabel to secondary axes in a tiled layout?
Hi everyone,
Dabbling a bit in MATLAB for the past year, mostly for data analysis. I am currently using version 2020 a and recently started enjoying the tiledlayout functionality. I was wondering, if there is a way to insert a shared y-axis title for secondary y-axes? For example, in this code:
t = tiledlayout(2,2);
for i = 1:4
f = figure(1);
ax = nexttile;
yyaxis left
x = (1:10);
y = rand(1,10)*100;
plot(x,y)
yyaxis right
plot(x,sin(y))
end
xlabel(t,’X’)
ylabel(t,’Y’)
I would like to insert a ylabel for the right axes (lets say ‘Y2’) that is ‘shared’ just as ‘Y’ is for the left axes. I haven’t found a solution that worked for me yet, all information I could find would either relate to tiled layouts or two y axes, I haven’t found something that combines the two.
I hope you understand my problem, any help is highly appreciated.Hi everyone,
Dabbling a bit in MATLAB for the past year, mostly for data analysis. I am currently using version 2020 a and recently started enjoying the tiledlayout functionality. I was wondering, if there is a way to insert a shared y-axis title for secondary y-axes? For example, in this code:
t = tiledlayout(2,2);
for i = 1:4
f = figure(1);
ax = nexttile;
yyaxis left
x = (1:10);
y = rand(1,10)*100;
plot(x,y)
yyaxis right
plot(x,sin(y))
end
xlabel(t,’X’)
ylabel(t,’Y’)
I would like to insert a ylabel for the right axes (lets say ‘Y2’) that is ‘shared’ just as ‘Y’ is for the left axes. I haven’t found a solution that worked for me yet, all information I could find would either relate to tiled layouts or two y axes, I haven’t found something that combines the two.
I hope you understand my problem, any help is highly appreciated. Hi everyone,
Dabbling a bit in MATLAB for the past year, mostly for data analysis. I am currently using version 2020 a and recently started enjoying the tiledlayout functionality. I was wondering, if there is a way to insert a shared y-axis title for secondary y-axes? For example, in this code:
t = tiledlayout(2,2);
for i = 1:4
f = figure(1);
ax = nexttile;
yyaxis left
x = (1:10);
y = rand(1,10)*100;
plot(x,y)
yyaxis right
plot(x,sin(y))
end
xlabel(t,’X’)
ylabel(t,’Y’)
I would like to insert a ylabel for the right axes (lets say ‘Y2’) that is ‘shared’ just as ‘Y’ is for the left axes. I haven’t found a solution that worked for me yet, all information I could find would either relate to tiled layouts or two y axes, I haven’t found something that combines the two.
I hope you understand my problem, any help is highly appreciated. tiledlayout, two y-axes, y-labels MATLAB Answers — New Questions
project file is not being updated
The complier project file is not being updated. When I exit Matlab and re-enter, opening the project file all setting are lost. Is there some setting to enable auto updates of the project file?The complier project file is not being updated. When I exit Matlab and re-enter, opening the project file all setting are lost. Is there some setting to enable auto updates of the project file? The complier project file is not being updated. When I exit Matlab and re-enter, opening the project file all setting are lost. Is there some setting to enable auto updates of the project file? project file MATLAB Answers — New Questions
F28379D: Cannot clear ePWM Trip Zone flags (TZFLG/TZOSTFLG) using Register Read/Write block in Simulink
Hi everyone,
I am having trouble clearing the Trip Zone flags for ePWM1 on a TMS320F28379D using the Register Read/Write blocks in Simulink.
System Configuration:
Hardware: TMS320F28379D (CPU1).
Software: MATLAB/Simulink (Embedded Coder).
Logic: I have two Register Read/Write blocks configured for Write operation:
Target: EPwm1Regs.TZCLR, bit field: OST.
Target: EPwm1Regs.TZOSTCLR, bit field: OST1.
Input: A uint16 constant of 1 is fed into both blocks.
The Issue:I am monitoring EPwm1Regs.TZFLG and EPwm1Regs.TZOSTFLG using a Scope. Even when the clear command is triggered, these flags stay at 1 and never transition to 0.
Confirmed details:
ISR Execution: The blocks are placed inside an ISR. I’ve verified the ISR is running correctly using a counter variable that increments as expected.
Register Behavior: I am aware that TZCLR and TZOSTCLR are "Write-1-to-Clear" (Self-clearing) and will read back as 0 on the Scope immediately after the write. However, the actual status flags (TZFLG) should return to 0 if the clear was successful, which is not happening here.
Access Mode: Using Specified bits mode for register access.
What could be preventing the TZFLG from clearing?
ThanksHi everyone,
I am having trouble clearing the Trip Zone flags for ePWM1 on a TMS320F28379D using the Register Read/Write blocks in Simulink.
System Configuration:
Hardware: TMS320F28379D (CPU1).
Software: MATLAB/Simulink (Embedded Coder).
Logic: I have two Register Read/Write blocks configured for Write operation:
Target: EPwm1Regs.TZCLR, bit field: OST.
Target: EPwm1Regs.TZOSTCLR, bit field: OST1.
Input: A uint16 constant of 1 is fed into both blocks.
The Issue:I am monitoring EPwm1Regs.TZFLG and EPwm1Regs.TZOSTFLG using a Scope. Even when the clear command is triggered, these flags stay at 1 and never transition to 0.
Confirmed details:
ISR Execution: The blocks are placed inside an ISR. I’ve verified the ISR is running correctly using a counter variable that increments as expected.
Register Behavior: I am aware that TZCLR and TZOSTCLR are "Write-1-to-Clear" (Self-clearing) and will read back as 0 on the Scope immediately after the write. However, the actual status flags (TZFLG) should return to 0 if the clear was successful, which is not happening here.
Access Mode: Using Specified bits mode for register access.
What could be preventing the TZFLG from clearing?
Thanks Hi everyone,
I am having trouble clearing the Trip Zone flags for ePWM1 on a TMS320F28379D using the Register Read/Write blocks in Simulink.
System Configuration:
Hardware: TMS320F28379D (CPU1).
Software: MATLAB/Simulink (Embedded Coder).
Logic: I have two Register Read/Write blocks configured for Write operation:
Target: EPwm1Regs.TZCLR, bit field: OST.
Target: EPwm1Regs.TZOSTCLR, bit field: OST1.
Input: A uint16 constant of 1 is fed into both blocks.
The Issue:I am monitoring EPwm1Regs.TZFLG and EPwm1Regs.TZOSTFLG using a Scope. Even when the clear command is triggered, these flags stay at 1 and never transition to 0.
Confirmed details:
ISR Execution: The blocks are placed inside an ISR. I’ve verified the ISR is running correctly using a counter variable that increments as expected.
Register Behavior: I am aware that TZCLR and TZOSTCLR are "Write-1-to-Clear" (Self-clearing) and will read back as 0 on the Scope immediately after the write. However, the actual status flags (TZFLG) should return to 0 if the clear was successful, which is not happening here.
Access Mode: Using Specified bits mode for register access.
What could be preventing the TZFLG from clearing?
Thanks epwm, f28379d, trip zone MATLAB Answers — New Questions
Source control SDK for MATLAB 2025
We have developed an inhouse source control integration for MATLAB 2021b using the Source control SDK previously available from https://se.mathworks.com/matlabcentral/fileexchange/61483-source-control-integration-software-development-kit . This fileexchange page has however recently been removed and all mentions of the SDK have been purged from the MATLAB online help pages.
Is there some alternative resource for authoring 3rd party source control plugins? If no, how are we supposed to handle our non-standard source control integration in MATLAB 2025+ ?We have developed an inhouse source control integration for MATLAB 2021b using the Source control SDK previously available from https://se.mathworks.com/matlabcentral/fileexchange/61483-source-control-integration-software-development-kit . This fileexchange page has however recently been removed and all mentions of the SDK have been purged from the MATLAB online help pages.
Is there some alternative resource for authoring 3rd party source control plugins? If no, how are we supposed to handle our non-standard source control integration in MATLAB 2025+ ? We have developed an inhouse source control integration for MATLAB 2021b using the Source control SDK previously available from https://se.mathworks.com/matlabcentral/fileexchange/61483-source-control-integration-software-development-kit . This fileexchange page has however recently been removed and all mentions of the SDK have been purged from the MATLAB online help pages.
Is there some alternative resource for authoring 3rd party source control plugins? If no, how are we supposed to handle our non-standard source control integration in MATLAB 2025+ ? source control, software control sdk MATLAB Answers — New Questions
Visualizing Satellite Skyplot Drawnow and Group Inconsistency.
I am developing a script that shows a sky plot of some satellites over a ground station. I am using drawnow and a for loop to make a video visualization of how the satellites az and el change with time. When satellites go below 0 degrees in azimuth, I want to change their color (I am using categorical groups for this). My script shows up differently if I run it in different ways. For instance, when I run it using a Live Script, the visualization only shows antenna positions moving when they all become part of the In View category, meaning there is a pause in movement before and after they all have elevations above 0 degrees. If I run the loop in the command line, the satellites move the entire time like they should BUT they do not retain their colors for their groups. Finally, if I run the Live Script, but pause execution and step through each iteration in the for loop, it works perfectly as intended, all satellites move continuously and the group colors are present. How can it be correct when parsing throught the for loop, but not correct when the full code is run?
<—This is from iterating line by line (it works!)
<— These two frames are from running the Live Editor all the way through, these are updates directly after one another. You can see that the satellite furthest to the right did not update its position fluidly, it just jumped to its actual position when the 3rd satellite came into the picture. And immediately when the 3rd is in view, all of the satellites move and the colors change instead of changing color one by one.
Here is the code.
[az, el, r, timeOut] = aer(gs(1), sat); % finds azimuth, elevation, range, and time between satellites and one
% ground station
skyplotHandle = skyplot(0, 0); % create skyplot for drawing
numSimSteps = (duration * 60 * 60) / sampleTime + 1; % steps in satellite scenario
for i = 1:numSimSteps
% here el(:,i) is a column vector with elevation angles of all satellites at time i
isOutOfView = false(size(el(:,i))); % assume everyone is in view
outOfViewIndex = find(el(:,i) < 0); % find elevation under 0 bc throws error in skyplot
el(outOfViewIndex,i) = 0; % set any elevations below 0 to 0
isOutOfView(outOfViewIndex) = true; % set boolean array to reflect out of view satellites
group = categorical(isOutOfView, [false true], ["Within View" "Outside View"]); % group together
ranges = string(round(r(:,i).*1e-3)); % convert to km, round for display, and define as string vector
ranges = append(ranges, " km"); % append for labeling
% set the data on the sky plot
set(skyplotHandle, ‘AzimuthData’, az(:,i), ‘ElevationData’, el(:,i), ‘LabelData’, ranges, GroupData=group);
drawnow % draw on figure
endI am developing a script that shows a sky plot of some satellites over a ground station. I am using drawnow and a for loop to make a video visualization of how the satellites az and el change with time. When satellites go below 0 degrees in azimuth, I want to change their color (I am using categorical groups for this). My script shows up differently if I run it in different ways. For instance, when I run it using a Live Script, the visualization only shows antenna positions moving when they all become part of the In View category, meaning there is a pause in movement before and after they all have elevations above 0 degrees. If I run the loop in the command line, the satellites move the entire time like they should BUT they do not retain their colors for their groups. Finally, if I run the Live Script, but pause execution and step through each iteration in the for loop, it works perfectly as intended, all satellites move continuously and the group colors are present. How can it be correct when parsing throught the for loop, but not correct when the full code is run?
<—This is from iterating line by line (it works!)
<— These two frames are from running the Live Editor all the way through, these are updates directly after one another. You can see that the satellite furthest to the right did not update its position fluidly, it just jumped to its actual position when the 3rd satellite came into the picture. And immediately when the 3rd is in view, all of the satellites move and the colors change instead of changing color one by one.
Here is the code.
[az, el, r, timeOut] = aer(gs(1), sat); % finds azimuth, elevation, range, and time between satellites and one
% ground station
skyplotHandle = skyplot(0, 0); % create skyplot for drawing
numSimSteps = (duration * 60 * 60) / sampleTime + 1; % steps in satellite scenario
for i = 1:numSimSteps
% here el(:,i) is a column vector with elevation angles of all satellites at time i
isOutOfView = false(size(el(:,i))); % assume everyone is in view
outOfViewIndex = find(el(:,i) < 0); % find elevation under 0 bc throws error in skyplot
el(outOfViewIndex,i) = 0; % set any elevations below 0 to 0
isOutOfView(outOfViewIndex) = true; % set boolean array to reflect out of view satellites
group = categorical(isOutOfView, [false true], ["Within View" "Outside View"]); % group together
ranges = string(round(r(:,i).*1e-3)); % convert to km, round for display, and define as string vector
ranges = append(ranges, " km"); % append for labeling
% set the data on the sky plot
set(skyplotHandle, ‘AzimuthData’, az(:,i), ‘ElevationData’, el(:,i), ‘LabelData’, ranges, GroupData=group);
drawnow % draw on figure
end I am developing a script that shows a sky plot of some satellites over a ground station. I am using drawnow and a for loop to make a video visualization of how the satellites az and el change with time. When satellites go below 0 degrees in azimuth, I want to change their color (I am using categorical groups for this). My script shows up differently if I run it in different ways. For instance, when I run it using a Live Script, the visualization only shows antenna positions moving when they all become part of the In View category, meaning there is a pause in movement before and after they all have elevations above 0 degrees. If I run the loop in the command line, the satellites move the entire time like they should BUT they do not retain their colors for their groups. Finally, if I run the Live Script, but pause execution and step through each iteration in the for loop, it works perfectly as intended, all satellites move continuously and the group colors are present. How can it be correct when parsing throught the for loop, but not correct when the full code is run?
<—This is from iterating line by line (it works!)
<— These two frames are from running the Live Editor all the way through, these are updates directly after one another. You can see that the satellite furthest to the right did not update its position fluidly, it just jumped to its actual position when the 3rd satellite came into the picture. And immediately when the 3rd is in view, all of the satellites move and the colors change instead of changing color one by one.
Here is the code.
[az, el, r, timeOut] = aer(gs(1), sat); % finds azimuth, elevation, range, and time between satellites and one
% ground station
skyplotHandle = skyplot(0, 0); % create skyplot for drawing
numSimSteps = (duration * 60 * 60) / sampleTime + 1; % steps in satellite scenario
for i = 1:numSimSteps
% here el(:,i) is a column vector with elevation angles of all satellites at time i
isOutOfView = false(size(el(:,i))); % assume everyone is in view
outOfViewIndex = find(el(:,i) < 0); % find elevation under 0 bc throws error in skyplot
el(outOfViewIndex,i) = 0; % set any elevations below 0 to 0
isOutOfView(outOfViewIndex) = true; % set boolean array to reflect out of view satellites
group = categorical(isOutOfView, [false true], ["Within View" "Outside View"]); % group together
ranges = string(round(r(:,i).*1e-3)); % convert to km, round for display, and define as string vector
ranges = append(ranges, " km"); % append for labeling
% set the data on the sky plot
set(skyplotHandle, ‘AzimuthData’, az(:,i), ‘ElevationData’, el(:,i), ‘LabelData’, ranges, GroupData=group);
drawnow % draw on figure
end satellite, drawnow, skyplot, categorical, plotting MATLAB Answers — New Questions
MATLAB 2024a hardware setup fails
so i am working on connecting my laptop to zc706 . I have done all the required step but connection fails with this error Interestingly , when i go to built configure and deploy it says that test connection was done but it cannot load the bit file due to SSH error on given IP address. This error occured previously so i restarted my PC fresh and everything and it was gone but now its is still there .so i am working on connecting my laptop to zc706 . I have done all the required step but connection fails with this error Interestingly , when i go to built configure and deploy it says that test connection was done but it cannot load the bit file due to SSH error on given IP address. This error occured previously so i restarted my PC fresh and everything and it was gone but now its is still there . so i am working on connecting my laptop to zc706 . I have done all the required step but connection fails with this error Interestingly , when i go to built configure and deploy it says that test connection was done but it cannot load the bit file due to SSH error on given IP address. This error occured previously so i restarted my PC fresh and everything and it was gone but now its is still there . zynq board, simulink, hardware setup MATLAB Answers — New Questions
How does Matlab interact with custom Diffusion models?
Matlab has been developing the DL Toolbox for many years, and I want to know what it can do now. I know there are already many official examples, but their overall cognitive effect is limited or even outdated.
For example, I want to start LDF-VFI now, which is a Diffusion model, but there are not many related examples. What extent can Matlab achieve this? By calling PyTorch through Matlab to reduce meaningless dependencies; by calling the converted ONNX through Matlab to break away from Python; even optimizing this scheme to reduce actual VRAM and other resource overheads?
If you could provide the specific code flow, I would greatly appreciate it.Matlab has been developing the DL Toolbox for many years, and I want to know what it can do now. I know there are already many official examples, but their overall cognitive effect is limited or even outdated.
For example, I want to start LDF-VFI now, which is a Diffusion model, but there are not many related examples. What extent can Matlab achieve this? By calling PyTorch through Matlab to reduce meaningless dependencies; by calling the converted ONNX through Matlab to break away from Python; even optimizing this scheme to reduce actual VRAM and other resource overheads?
If you could provide the specific code flow, I would greatly appreciate it. Matlab has been developing the DL Toolbox for many years, and I want to know what it can do now. I know there are already many official examples, but their overall cognitive effect is limited or even outdated.
For example, I want to start LDF-VFI now, which is a Diffusion model, but there are not many related examples. What extent can Matlab achieve this? By calling PyTorch through Matlab to reduce meaningless dependencies; by calling the converted ONNX through Matlab to break away from Python; even optimizing this scheme to reduce actual VRAM and other resource overheads?
If you could provide the specific code flow, I would greatly appreciate it. matlab, deep learning, stable diffusion MATLAB Answers — New Questions
Python virtual environment in Matlab
Hi, i tried to run Pyhon code in Matlab by using a virtual environment (venv). If i run from the virtual environment i get an error "Transport stopped"
>> pe2 = pyenv("Version","C:pyth_testtest3Scriptspython")
pe2 =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:pyth_testtest3Scriptspython.EXE"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:pyth_testtest3"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
Transport stopped.
if i run
>> pe = pyenv(‘Version’,’3.8′,"ExecutionMode","OutOfProcess")
pe =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:UsersbirgervAppDataLocalProgramsPythonPython38pythonw.exe"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:UsersbirgervAppDataLocalProgramsPythonPython38"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
hello world
>>
it works. I really need to work in a virtual environment, but can not find out why it is not working.Hi, i tried to run Pyhon code in Matlab by using a virtual environment (venv). If i run from the virtual environment i get an error "Transport stopped"
>> pe2 = pyenv("Version","C:pyth_testtest3Scriptspython")
pe2 =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:pyth_testtest3Scriptspython.EXE"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:pyth_testtest3"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
Transport stopped.
if i run
>> pe = pyenv(‘Version’,’3.8′,"ExecutionMode","OutOfProcess")
pe =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:UsersbirgervAppDataLocalProgramsPythonPython38pythonw.exe"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:UsersbirgervAppDataLocalProgramsPythonPython38"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
hello world
>>
it works. I really need to work in a virtual environment, but can not find out why it is not working. Hi, i tried to run Pyhon code in Matlab by using a virtual environment (venv). If i run from the virtual environment i get an error "Transport stopped"
>> pe2 = pyenv("Version","C:pyth_testtest3Scriptspython")
pe2 =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:pyth_testtest3Scriptspython.EXE"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:pyth_testtest3"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
Transport stopped.
if i run
>> pe = pyenv(‘Version’,’3.8′,"ExecutionMode","OutOfProcess")
pe =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:UsersbirgervAppDataLocalProgramsPythonPython38pythonw.exe"
Library: "C:UsersbirgervAppDataLocalProgramsPythonPython38python38.dll"
Home: "C:UsersbirgervAppDataLocalProgramsPythonPython38"
Status: NotLoaded
ExecutionMode: OutOfProcess
>> py.print("hello world")
hello world
>>
it works. I really need to work in a virtual environment, but can not find out why it is not working. python, virtual environment MATLAB Answers — New Questions
Any way to control Matlab window focus?
I’ve seen questions asked related to figures explicitly, but not more generally.
I don’t know when it changed, I’ve just suffered with it from then until now (and probably for future too), but is there anything I can do to stop other bits of Matlab constantly taking focus away from the command window?
I’ve worked in basically the same way for 20 years in Matlab – I have code in files, sometimes it opens figures, sometimes I have the variable editor open, often it will hit a breakpoint where I want to investigate something.
99% if the time what I next want to do is type something in the command window – e.g. I put my breakpoint in because I want to investigate what is happening there, or I opened a figure and now want to set an axes property on it from command line or whatever, I always want to be typing in command window in these situations.
For many years this worked exactly as I want it to, which I guess is why that became my habit. But in more recent versions of Matlab focus is more and more beings stolen by other things:
I create a uifigure, the uifigure window has focus, so my typing achieves nothing
I hit a breakpoint and focus is on the editor window of the file with the breakpoint so now half the time I start typing the code I want to test on command window into my running file and have to undo it. This is never the behaviour I want.
Also recently I’ve been working with the variable editor open and now that steals focus on a breakpoint often too so now when I start typing it replaces some arbitrary cell of my array with text.
Is there really no way I can turn this awful behaviour off and just have it keep focus on the Command window unless I explicitly click on something else (or whatever it was it used to do, that was so intuitive to work with – I never really pinned down exactly what it did because it just worked in a common sense way)?I’ve seen questions asked related to figures explicitly, but not more generally.
I don’t know when it changed, I’ve just suffered with it from then until now (and probably for future too), but is there anything I can do to stop other bits of Matlab constantly taking focus away from the command window?
I’ve worked in basically the same way for 20 years in Matlab – I have code in files, sometimes it opens figures, sometimes I have the variable editor open, often it will hit a breakpoint where I want to investigate something.
99% if the time what I next want to do is type something in the command window – e.g. I put my breakpoint in because I want to investigate what is happening there, or I opened a figure and now want to set an axes property on it from command line or whatever, I always want to be typing in command window in these situations.
For many years this worked exactly as I want it to, which I guess is why that became my habit. But in more recent versions of Matlab focus is more and more beings stolen by other things:
I create a uifigure, the uifigure window has focus, so my typing achieves nothing
I hit a breakpoint and focus is on the editor window of the file with the breakpoint so now half the time I start typing the code I want to test on command window into my running file and have to undo it. This is never the behaviour I want.
Also recently I’ve been working with the variable editor open and now that steals focus on a breakpoint often too so now when I start typing it replaces some arbitrary cell of my array with text.
Is there really no way I can turn this awful behaviour off and just have it keep focus on the Command window unless I explicitly click on something else (or whatever it was it used to do, that was so intuitive to work with – I never really pinned down exactly what it did because it just worked in a common sense way)? I’ve seen questions asked related to figures explicitly, but not more generally.
I don’t know when it changed, I’ve just suffered with it from then until now (and probably for future too), but is there anything I can do to stop other bits of Matlab constantly taking focus away from the command window?
I’ve worked in basically the same way for 20 years in Matlab – I have code in files, sometimes it opens figures, sometimes I have the variable editor open, often it will hit a breakpoint where I want to investigate something.
99% if the time what I next want to do is type something in the command window – e.g. I put my breakpoint in because I want to investigate what is happening there, or I opened a figure and now want to set an axes property on it from command line or whatever, I always want to be typing in command window in these situations.
For many years this worked exactly as I want it to, which I guess is why that became my habit. But in more recent versions of Matlab focus is more and more beings stolen by other things:
I create a uifigure, the uifigure window has focus, so my typing achieves nothing
I hit a breakpoint and focus is on the editor window of the file with the breakpoint so now half the time I start typing the code I want to test on command window into my running file and have to undo it. This is never the behaviour I want.
Also recently I’ve been working with the variable editor open and now that steals focus on a breakpoint often too so now when I start typing it replaces some arbitrary cell of my array with text.
Is there really no way I can turn this awful behaviour off and just have it keep focus on the Command window unless I explicitly click on something else (or whatever it was it used to do, that was so intuitive to work with – I never really pinned down exactly what it did because it just worked in a common sense way)? window focus MATLAB Answers — New Questions
What errors can be found on this script?
% Given data: Study hours and corresponding exam scores
study_hours = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21];
exam_scores = [50, 55, 60, 65, 72, 78, 83, 87, 90, 94, 96];
% Step 1: Create a scatter plot
% Use the scatter function to plot study_hours vs. exam_scores
scatter(study_hours, exam_scores) % <– Modify this to customize the markers
% Step 2: Label the axes
% Use xlabel(‘text’) and ylabel(‘text’) to describe the data
xlabel(‘Study Hours per Week’) % <– Fill in the x-axis label
ylabel(‘Exam Score (%)’) % <– Fill in the y-axis label
% Step 3: Add a title
% Use the title function to describe the relationship
title(‘Relationship Between Study Hours and Exam Scores’) % <– Fill in an appropriate title
% Step 4: Customize marker style, size, and color
% Modify scatter to change marker shape, size, and color
% Example: scatter(x, y, size, ‘color’, ‘filled’)
% Uncomment and modify the line below
scatter(study_hours, exam_scores, 50, ‘b’, ‘filled’)
% Step 5: Enable the grid
% Uncomment the line below to turn on the grid
grid on
% Step 6: Add a legend
% Use the legend function to describe the data points
legend(‘Student Data’) % <– Fill in an appropriate legend% Given data: Study hours and corresponding exam scores
study_hours = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21];
exam_scores = [50, 55, 60, 65, 72, 78, 83, 87, 90, 94, 96];
% Step 1: Create a scatter plot
% Use the scatter function to plot study_hours vs. exam_scores
scatter(study_hours, exam_scores) % <– Modify this to customize the markers
% Step 2: Label the axes
% Use xlabel(‘text’) and ylabel(‘text’) to describe the data
xlabel(‘Study Hours per Week’) % <– Fill in the x-axis label
ylabel(‘Exam Score (%)’) % <– Fill in the y-axis label
% Step 3: Add a title
% Use the title function to describe the relationship
title(‘Relationship Between Study Hours and Exam Scores’) % <– Fill in an appropriate title
% Step 4: Customize marker style, size, and color
% Modify scatter to change marker shape, size, and color
% Example: scatter(x, y, size, ‘color’, ‘filled’)
% Uncomment and modify the line below
scatter(study_hours, exam_scores, 50, ‘b’, ‘filled’)
% Step 5: Enable the grid
% Uncomment the line below to turn on the grid
grid on
% Step 6: Add a legend
% Use the legend function to describe the data points
legend(‘Student Data’) % <– Fill in an appropriate legend % Given data: Study hours and corresponding exam scores
study_hours = [1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21];
exam_scores = [50, 55, 60, 65, 72, 78, 83, 87, 90, 94, 96];
% Step 1: Create a scatter plot
% Use the scatter function to plot study_hours vs. exam_scores
scatter(study_hours, exam_scores) % <– Modify this to customize the markers
% Step 2: Label the axes
% Use xlabel(‘text’) and ylabel(‘text’) to describe the data
xlabel(‘Study Hours per Week’) % <– Fill in the x-axis label
ylabel(‘Exam Score (%)’) % <– Fill in the y-axis label
% Step 3: Add a title
% Use the title function to describe the relationship
title(‘Relationship Between Study Hours and Exam Scores’) % <– Fill in an appropriate title
% Step 4: Customize marker style, size, and color
% Modify scatter to change marker shape, size, and color
% Example: scatter(x, y, size, ‘color’, ‘filled’)
% Uncomment and modify the line below
scatter(study_hours, exam_scores, 50, ‘b’, ‘filled’)
% Step 5: Enable the grid
% Uncomment the line below to turn on the grid
grid on
% Step 6: Add a legend
% Use the legend function to describe the data points
legend(‘Student Data’) % <– Fill in an appropriate legend plotting MATLAB Answers — New Questions
Simscape export FMU – expose component internal variables
I have the task of modelling and exporting from Simscape as FMU. For example, I can say I am modelling a spring mass damper
system and exporting it as FMU. I have a software at the other end, which loads the FMU and simulates it. I need to expose the
position and other information of the mass element, but don’t want to add a sensor and create a FMU outport for it. Is there someway
I can expose the mass element internal information as variables in an FMU, so that they can be accessed during simulation after
export?I have the task of modelling and exporting from Simscape as FMU. For example, I can say I am modelling a spring mass damper
system and exporting it as FMU. I have a software at the other end, which loads the FMU and simulates it. I need to expose the
position and other information of the mass element, but don’t want to add a sensor and create a FMU outport for it. Is there someway
I can expose the mass element internal information as variables in an FMU, so that they can be accessed during simulation after
export? I have the task of modelling and exporting from Simscape as FMU. For example, I can say I am modelling a spring mass damper
system and exporting it as FMU. I have a software at the other end, which loads the FMU and simulates it. I need to expose the
position and other information of the mass element, but don’t want to add a sensor and create a FMU outport for it. Is there someway
I can expose the mass element internal information as variables in an FMU, so that they can be accessed during simulation after
export? simscape, fmu, internal variables MATLAB Answers — New Questions









