Category: Matlab
Category Archives: Matlab
assigning values with []
[a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2?[a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2? [a,b]=[1,2]
Why doesn’t this work? How to rewrite into what is easier and more succinct than a=1; b=2? matlab MATLAB Answers — New Questions
Unknown error during installation MATLAB2015a
During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that?During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that? During the installation of Matlab 2015a, at a level of 99% a pop-up window appeared with the following notification: " Unknown Error. The application encountered an unexpected error and needs to close. You may want to try re-installing your product(s). More information can be found at C:users…Tempmathworks_cform.log".
Why does this error appear during installation?
How can I solve that? error, installation MATLAB Answers — New Questions
Minor mistake Writing a function but error
Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x));Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x)); Hello just a quick question, I am writing a code but an error keeps poping up for the function I entered
By any chance would you know why it keeps coming up as a red warning
f=@ (1./x)+(sqrt(x).*exp(x)); function, error, display MATLAB Answers — New Questions
Trying to add callback function in class
I am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
endI am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
end I am attempting to create a class the will have two line ROI objects. This class should have a callback function for when the lines are moved by the user. I am able to add a listener to the lines but only if the callback function is static.
Is it possible to do this without using a static method? Ultimatly I would like to use the callback method to compare the positions of the two lines as one of them is moved.
classdef imageRange < handle
properties
region double
line1
line2
rect
X double
end
methods
function obj = imageRange(axes, dataAxes)
x = dataAxes{1,4};
y = dataAxes{2,4};
midpoint = mean([x(1),x(3)]);
obj.X = floor(midpoint);
obj.rect = rectangle(axes,’Position’,[obj.X,y(1),…
ceil(midpoint)-floor(midpoint), y(3) – y(1)]);
obj.rect.EdgeColor = [0,0,0,0];
obj.rect.FaceColor = [.5,.5,.5];
obj.rect.FaceAlpha = .1;
obj.line1 = drawline(axes,’Position’,[floor(midpoint), y(1); …
floor(midpoint), y(3)],’Color’,[0.6350 0.0780 0.1840], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
addlistener(obj.line1, ‘MovingROI’, @(src,event)obj.allevents(src,event));
obj.line2 = drawline(axes,’Position’,[ceil(midpoint), y(1); …
ceil(midpoint), y(3)],’Color’,[0 0.4470 0.7410], …
‘InteractionsAllowed’,’translate’, …
‘MarkerSize’,.1, …
‘LineWidth’,1);
obj.region = dataAxes{1,5};
end
end
methods (Static)
function allevents(src,event)
event.PreviousPosition(1,1)
end
end
end static methods, class MATLAB Answers — New Questions
Reverse 2D-lookup table in Simulink
I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink?I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink? I tried to implement a reverse 2D lookup table in Simulink according to the following description by Fangjun Jiang:
https://de.mathworks.com/matlabcentral/answers/12809-reverse-2d-lookup-table?s_tid=sug_su
First, I wrote the following Matlab code for testing and it does exactly what I expect:
% Absolute eccentricity range
e = 0:1e-06:1.5e-05;
% Piston phase angle range
rad = 0:2*pi/400:2*pi;
% Load capacity matrix
load(‘Tragkraft_alpha_AK_kpl_V03.mat’);
load_cap = Tragkraft_alpha_AK_kpl_V03;
% Instant piston phase angle
rad_dyn = 3.12588469032184;
% Reverse 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% Instant load capacity
load_dyn = 659.331131439451;
% Instant absolute eccentricity
e_dyn = interp1(lookup,e,load_dyn);
After that, I tried to implement it in Simulink using a MATLAB function block with the following code:
function e_dyn = fcn(rad_dyn, load_dyn, load_cap)
% absolute eccentricity range
e = 0:1e-06:1.5e-05;
% piston phase angle range
rad = 0:2*pi/400:2*pi;
% 2D lookup table for load capacity
lookup = interp2(e,rad,load_cap,e,rad_dyn);
% instant absolute eccentricity
e_dyn=interp1(lookup,e,load_dyn);
However, this leads to the following error message that I don’t really understand. In my understanding the Simulink model should do exactly the same as the Matlab code. Can anybody tell me how to fix that in Simulink? lookup table, reverse, simulink MATLAB Answers — New Questions
Invalid initial condition error
I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]);I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]); I have to solve the sistem of differential equation odesys with the condition imposed in bc vector. I obtain the "Invalid Initial Condition" at the line where v is defined, even if the domain for the boundary condition is correct. I must keep it a symbolic solution and a0 is a costant.
%% ANALYTICAL MODEL FOR A DCB SPECIMEN UNDER THE CONDITION OF PRESCRIBED DISPLACEMENTS
%% Linear Elastic Phase
%———
syms x d v0(x) v1(x) v2(x) Lcz
%———
phi0 = -diff(v0,x);
M0 = E*I*diff(v0,x,2);
T0 = E*I*diff(v0,x,3);
phi1 = -diff(v1,x);
M1 = E*I*diff(v1,x,2);
T1 = E*I*diff(v1,x,3);
phi2 = -diff(v2,x);
M2 = E*I*diff(v2,x,2);
T2 = E*I*diff(v2,x,3);
%———
ode_0 = diff(v0,x,4) == 0;
ode_1 = diff(v1,x,4) – 2*w*(lambda^2)*diff(v1,x,2) + (lambda^4)*v1 == 0;
ode_2 = diff(v2,x,4) + 2*ps*(k^2)*diff(v2,x,2) – k^4*(v2 – d_c/2) == 0;
%———
syms xL xR xI
xL = -a0 – Lcz;
xI = -Lcz;
xR = L – a0 – Lcz;
c1 = v0(xL) == d/2;
c2 = M0(xL) == 0;
c3 = v0(xI) == v2(xI);
c4 = phi0(xI) == phi2(xI);
c5 = M0(xI) == M2(xI);
c6 = T0(xI) == T2(xI);
c7 = v1(0) == v2(0);
c8 = phi1(0) == phi2(0);
c9 = M1(0) == M2(0);
c10 = T1(0) == T2(0);
c11 = v1(xR) == 0;
c12 = phi1(xR) == 0;
%———
odesys = [ode_0; ode_1; ode_2];
bc = [c1; c2; c3; c4; c5; c6; c7; c8; c9; c10; c11; c12];
v = dsolve(odesys, bc);
%———
v1_sol(x,d,Lcz) = simplify(v.v1);
v0_sol(x,d,Lcz) = simplify(v.v0);
v2_sol(x,d,Lcz) = simplify(v.v2);
phi0_sol(x,d,Lcz) = diff(v0_sol,x);
phi1_sol(x,d,Lcz) = diff(v1_sol,x);
phi2_sol(x,d,Lcz) = diff(v2_sol,x);
M0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,2);
M1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,2);
M2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,2);
T0_sol(x,d,Lcz) = E*I*diff(v0_sol,x,3);
T1_sol(x,d,Lcz) = E*I*diff(v1_sol,x,3);
T2_sol(x,d,Lcz) = E*I*diff(v2_sol,x,3);
%———
d_lim = solve(v0_sol(0,d,0) == d_0/2,d);
% d_max = solve(v0_sol(0,d,0) == d_0/2,d);
% Lcz_max = solve(v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0, x,[0 50]);
[d_max, Lcz_max] = solve([v1_sol(0,d,Lcz) – d_0/2 == 0, v2_sol(-Lcz,d_max,Lcz) – d_c/2 == 0],[d,Lcz]); dsolve, ode, symbolic MATLAB Answers — New Questions
Error while creating Target starting from reference target ‘Aurix Tricore TC3x’
Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you!Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you! Hello,
I’m trying to use the Aurix Tricore TC3x Simulink Support Package to work with my TC36 board.
Since the available hardware options are only TC37, TC38, and TC39, I would like to create a new target for the TC36.
Rather than creating a new target from scratch and manually selecting all the features, I’m trying to inherit everything from the existing target and only modify the shared libraries (iLLD), the linker and the loader.
I’m using the following command:
tgt = createTarget(‘my TC36’, ‘Infineon AURIX TC3x’,’C:/TC36_TargetV1′, ‘initialize’)
But I get this error:
Error using matlabshared.targetsdk.Target/loadReferenceTargetObjects
Unable to load reference target ‘Infineon AURIX TC3x’.A table row name subscript must be a character vector, string array, or cell array of
character vectors
Error in matlabshared.targetsdk.Target
Error in createTarget (line 129)
targetObj = matlabshared.targetsdk.Target(name,refTarget,targetFolder,option);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Proceeding, I discovered that the error comes from:
matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
That gives the following:
>> matlabshared.targetsdk.loadTarget(‘Infineon AURIX TC3x’)
Error using {} (line 162)
A table row name subscript must be a character vector, string array, or cell array of character vectors
Error in matlabshared.targetsdk.Target/mapFeature
Error in matlabshared.targetsdk.Target/map
Error in matlabshared.targetsdk.Target/addNewBaremetalScheduler
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
Error in matlabshared.targetsdk.loadTarget
In particular in braceAssign.m on the line 162.
I also tried to use the loadTarget function with the ‘ARM Cortex-A’ target and it worked.
Therefore, The problem can be that I don’t know the exact target name of Infineon AURIX TC3x to use as the reference target, but I also tried to insert a wrong name argument to the loadTarget function and it gives a different result:
matlabshared.targetsdk.loadTarget(‘Infineon’)
Error using matlabshared.targetsdk.loadTarget
The target ‘Infineon’ is not registered. Make sure that the name of the target is correct and that its folders are on the MATLAB path. Also, make
sure to run ‘sl_refresh_customizations’ after you restart MATLAB.
Concluding, how can I use the Infineon AURIX TC3x as reference target?
Thank you! compiler sdk, embedded coder, infineon aurix tc3x support package, target sdk MATLAB Answers — New Questions
How to extract gray matter volumes based on a specific atlas using SPM and CAT12?
Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance!Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance! Hi everyone,
I’m new to MATLAB, SPM and CAT12, and I’m learning how to perform Voxel-Based Morphometry .
I’ve already preprocessed a T1-weighted MRI image using CAT12 and obtained TIV statis. Now I’d like to extract regional gray matter volume information from the mwp1.nii file, based on anatomical regions defined by an atlas (e.g., AAL atlas).
Could someone please guide me on how to do this?
Thanks in advance! image segmentation, cat12, spm, mri, gray matter MATLAB Answers — New Questions
Can someone help me name all this component Thak youu
name for each componentname for each component name for each component simulink, block diagram MATLAB Answers — New Questions
Clarification with IEC certified tools and the need for separate IEC certification kit
Hi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advanceHi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advance Hi,
As far as I read from the MATLAB website, the tools such as Matlab, Simulink, Embedded Coder,… are already ISO/IEC certified tools, but then, I am confused on the need for separate IEC certification kit available, to qualify those tools? Could you please clarify?
Thanks in advance iec61508, iso26262, toolbox, certification MATLAB Answers — New Questions
Ignoring Octave-specific code in Matlab 2024b
I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there.I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there. I have a following bit of code specific to Octave, in a project that is also meant to be run in Matlab:
if (isOctave())
% Set the tick label precision
set(gca, ‘xticklabel’, cellstr(num2str(get(gca, ‘xtick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
set(gca, ‘yticklabel’, cellstr(num2str(get(gca, ‘ytick’) (:), "%.2f"))) %#ok<SBTMP,*ALL>
% Set axis font size
set(gca, ‘fontsize’, 12)
end
That particular code is needed for Octave to display figures properly.
And isOctave.m is as follows:
function retval = isOctave
persistent cacheval; % speeds up repeated calls
if isempty (cacheval)
cacheval = (exist ("OCTAVE_VERSION", "builtin") > 0);
end
retval = cacheval;
end
isOctave() has been tested to properly return 0 (false) in Matlab and 1 (true) in Octave.
Now, in Matlab an error message is produced due to the indexing with a colon:
Error: File: foobar.m Line: 117 Column: 41
Invalid array indexing.
And since the code to be executed is guarded with isOctave(), which returns ‘false’, logically that code section should not even be executed in Matlab. So it’s weird that such error is being generated. And it even persist after adding the suppresstion %#ok<SBTMP,*ALL> in there. matlab, octave, code, portable MATLAB Answers — New Questions
Change in OOP programming between 2014a and 2016 – Structures not recognized anymore?
Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks !Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks ! Hello all,
I’m working on a project that was coded in 2014a version and trying to bring it up the MatLab versions. I tried to bring it from the 2014a to 2016a version but I seem to have an issue with how the Object Oriented Programming files are handled by Matlab.
Here’s a ‘picture’ of my directory :
I have an issue where Matlab says that :
Warning: ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformation’ exceeds MATLAB’s maximum name length of 63 characters
and has been truncated to ‘bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio’.
….
Undefined variable "aaa" or class "aaa.bbb.ccc.ddd.eee.fff.ggg.B_AutomaticTransformatio".
Error in … (line …)
oPlugin = aaa.(sPlugin(6:end))(this, oParent, oGUI, varargin{:});
Has something changed in the way files and folders are handled my Matlab / OOP in the transition from 2014a to 2016a as it’s working in the 2014a version?
Also, I’m going from 2014a to 2023b versions of Matlab. Is a ‘stop’ at the 2016a version before going to the 2023b version worth it?
Thanks ! oop, structures MATLAB Answers — New Questions
How do I configure an options file with multiple licenses?
I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license?I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license? I have multiple licenses for MATLAB that I run off of one license server. How do I direct my users to the appropriate license? MATLAB Answers — New Questions
Where can I find MATLAB license files?
Where can I find MATLAB license files? Where can I find MATLAB license files? Where can I find MATLAB license files? MATLAB Answers — New Questions
Issues with HDL coder IFFT/FFT Processing with 4×1 Vectors and Data Reordering
I have created an OFDM system where, at the transmitter (Tx) side, I perform IFFT, add a cyclic prefix (CP), and then on the receiver (Rx) side, I perform FFT followed by channel estimation and equalization.
However, I encountered an issue. When I pass scalar values through the IFFT and FFT blocks, everything works fine, and the constellation graph appears as expected. However, my goal is to process data in 4×1 vectors to increase the sampling rate. After processing 4×1 vectors, the constellation graph does not appear correctly, and it seems the data is not in the expected order after the IFFT block.
My question is: when converting data to the time domain with IFFT, does the order of the data change? For example, I expect the data to go through as {0,1,2,3}, {4,5,6,7}, {8,9,10,11}, {12,13,14,15}, etc. But after IFFT, should I expect it to be {0,4,8,12}, {1,5,9,13}, and so on? If this is the case, should I introduce a reordering step after the IFFT to restore the data to its original order?
Additionally, could there be issues related to bit-reversed order, or other similar problems such as "output/input in bit-reversed order"? If you could clarify the meaning of this and how it might affect my system, I would greatly appreciate it.
For your reference, I am using HDL Coder and leveraging the HDL optimized IFFT/FFT blocks in my design.
Finally, I would be grateful if you could provide any resources or further explanations on the index order and the steps needed to process data in vector form, including any additional adjustments I need to make for IFFT/FFT operations.
Thank you very much for your time and assistance. I look forward to your response.I have created an OFDM system where, at the transmitter (Tx) side, I perform IFFT, add a cyclic prefix (CP), and then on the receiver (Rx) side, I perform FFT followed by channel estimation and equalization.
However, I encountered an issue. When I pass scalar values through the IFFT and FFT blocks, everything works fine, and the constellation graph appears as expected. However, my goal is to process data in 4×1 vectors to increase the sampling rate. After processing 4×1 vectors, the constellation graph does not appear correctly, and it seems the data is not in the expected order after the IFFT block.
My question is: when converting data to the time domain with IFFT, does the order of the data change? For example, I expect the data to go through as {0,1,2,3}, {4,5,6,7}, {8,9,10,11}, {12,13,14,15}, etc. But after IFFT, should I expect it to be {0,4,8,12}, {1,5,9,13}, and so on? If this is the case, should I introduce a reordering step after the IFFT to restore the data to its original order?
Additionally, could there be issues related to bit-reversed order, or other similar problems such as "output/input in bit-reversed order"? If you could clarify the meaning of this and how it might affect my system, I would greatly appreciate it.
For your reference, I am using HDL Coder and leveraging the HDL optimized IFFT/FFT blocks in my design.
Finally, I would be grateful if you could provide any resources or further explanations on the index order and the steps needed to process data in vector form, including any additional adjustments I need to make for IFFT/FFT operations.
Thank you very much for your time and assistance. I look forward to your response. I have created an OFDM system where, at the transmitter (Tx) side, I perform IFFT, add a cyclic prefix (CP), and then on the receiver (Rx) side, I perform FFT followed by channel estimation and equalization.
However, I encountered an issue. When I pass scalar values through the IFFT and FFT blocks, everything works fine, and the constellation graph appears as expected. However, my goal is to process data in 4×1 vectors to increase the sampling rate. After processing 4×1 vectors, the constellation graph does not appear correctly, and it seems the data is not in the expected order after the IFFT block.
My question is: when converting data to the time domain with IFFT, does the order of the data change? For example, I expect the data to go through as {0,1,2,3}, {4,5,6,7}, {8,9,10,11}, {12,13,14,15}, etc. But after IFFT, should I expect it to be {0,4,8,12}, {1,5,9,13}, and so on? If this is the case, should I introduce a reordering step after the IFFT to restore the data to its original order?
Additionally, could there be issues related to bit-reversed order, or other similar problems such as "output/input in bit-reversed order"? If you could clarify the meaning of this and how it might affect my system, I would greatly appreciate it.
For your reference, I am using HDL Coder and leveraging the HDL optimized IFFT/FFT blocks in my design.
Finally, I would be grateful if you could provide any resources or further explanations on the index order and the steps needed to process data in vector form, including any additional adjustments I need to make for IFFT/FFT operations.
Thank you very much for your time and assistance. I look forward to your response. hdl coder, ifft, fft MATLAB Answers — New Questions
Matlab App: Get cursor position in axis continuously, keep plot interactivity
Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this?Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this? Hi there,
I’m trying to create a matlab app in which users can create geometric objects and use them for some calculations later.
These are displayed in a 3D axis, rotated slightly. I am trying to create user functions to draw lines inside that axis. For this, I wan to implement continuously displayed x,y coordinates, or crosshairs or similar, as well as data snapping. Users will only draw 2D objects on the x,y plane. I still want users to be able to rotate the plot, zoom and pan normally with the mouse.
If I use a WindowButtonMotionFcn, then I lose plot interactivity with the mouse. If I use other means of getting the cursor position, like java.awt.MouseInfo.getPointerInfo().getLocation() and getpixelposition() or similar gui coordinate functions, I have to deal with a rotated camera and axis transformation. This makes "hit detection" on the data very cumbersome.
Using axes.CurrentPoint seems useless, because it only updates when the mouse is clicked, not continuously.
Any ideas on how to do this? appdesigner, app designer, windowbuttonmotionfcn, axes, matlab gui MATLAB Answers — New Questions
Got error in resample function
I am a beginner of Matlab and I was trying to resample y by this resample function
but i got an error: " Incorrect number or types of inputs or outputs for function resample. "
please tell me what is the problem if you know. thanks a lot.
load handel.mat
y = y(:);
Fs = 8192;
fc = 2e5;
Fs_new = ceil( (Fs/2 + fc) / Fs * 2 ) * Fs;
y_resampled = resample(y,Fs_new,Fs);I am a beginner of Matlab and I was trying to resample y by this resample function
but i got an error: " Incorrect number or types of inputs or outputs for function resample. "
please tell me what is the problem if you know. thanks a lot.
load handel.mat
y = y(:);
Fs = 8192;
fc = 2e5;
Fs_new = ceil( (Fs/2 + fc) / Fs * 2 ) * Fs;
y_resampled = resample(y,Fs_new,Fs); I am a beginner of Matlab and I was trying to resample y by this resample function
but i got an error: " Incorrect number or types of inputs or outputs for function resample. "
please tell me what is the problem if you know. thanks a lot.
load handel.mat
y = y(:);
Fs = 8192;
fc = 2e5;
Fs_new = ceil( (Fs/2 + fc) / Fs * 2 ) * Fs;
y_resampled = resample(y,Fs_new,Fs); resample, matlab, error MATLAB Answers — New Questions
How to generate custom unoptimized code within a system composer software architecture model?
C-function code generation appears to work differently when generating code inside of a system composer software architecture model isntead of a standalone simulink model. I am trying to insert certain processer primitaves (mutexes) into my simulink model such that it is incorporated into the autogenerated code. It is a few simple lines of c++ code, so I opted to use the C-function block. In both cases, I have specified in the c-function dialogue window "Generate code as-is (optimizations off)"
Inside of an export-function simulink model, I created a c-function block that includes a comment and then a simple line of code, which generates correctly:
However, if I copy this exact same c-function into an export-function model within a system composer software architecture model, it no longer generates my my specified code. Instead, it generates function calls but does not define the functions anywhere. (Even doing a simple text search of my entire workspace only shows that the function call shown below gets generated).C-function code generation appears to work differently when generating code inside of a system composer software architecture model isntead of a standalone simulink model. I am trying to insert certain processer primitaves (mutexes) into my simulink model such that it is incorporated into the autogenerated code. It is a few simple lines of c++ code, so I opted to use the C-function block. In both cases, I have specified in the c-function dialogue window "Generate code as-is (optimizations off)"
Inside of an export-function simulink model, I created a c-function block that includes a comment and then a simple line of code, which generates correctly:
However, if I copy this exact same c-function into an export-function model within a system composer software architecture model, it no longer generates my my specified code. Instead, it generates function calls but does not define the functions anywhere. (Even doing a simple text search of my entire workspace only shows that the function call shown below gets generated). C-function code generation appears to work differently when generating code inside of a system composer software architecture model isntead of a standalone simulink model. I am trying to insert certain processer primitaves (mutexes) into my simulink model such that it is incorporated into the autogenerated code. It is a few simple lines of c++ code, so I opted to use the C-function block. In both cases, I have specified in the c-function dialogue window "Generate code as-is (optimizations off)"
Inside of an export-function simulink model, I created a c-function block that includes a comment and then a simple line of code, which generates correctly:
However, if I copy this exact same c-function into an export-function model within a system composer software architecture model, it no longer generates my my specified code. Instead, it generates function calls but does not define the functions anywhere. (Even doing a simple text search of my entire workspace only shows that the function call shown below gets generated). software architecture models, c-functions, export-function models, embedded coder, system composer MATLAB Answers — New Questions
When using a writetable to write a table file containing data in datetime format to Excel, the saved datetime data in Excel is not in the same format as the datetime data
The table data is as follows:
Use the following writetable function code to save data to Excel,the exported result is shown in the following figure:
The time display is incomplete.
How to set the exported time format to be the same as the original data?
writetable(T, filePath);The table data is as follows:
Use the following writetable function code to save data to Excel,the exported result is shown in the following figure:
The time display is incomplete.
How to set the exported time format to be the same as the original data?
writetable(T, filePath); The table data is as follows:
Use the following writetable function code to save data to Excel,the exported result is shown in the following figure:
The time display is incomplete.
How to set the exported time format to be the same as the original data?
writetable(T, filePath); writetable,datetime,excel MATLAB Answers — New Questions
Plot along line from. PDE solution
The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet")The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet") The code below solves a 1-D, transient heat transfer problem set up as in general PDE format. The solution is plotted in color across the domain from 0 to 0.1 after 10 seconds have elapsed. What is the best way to plot the temperature across the length of this domain at this final time?
Thanks
clear all;
%% Create transient thermal model
thermalmodel = createpde(1);
R1= [3,4,0,0.1,0.1,0,0,0,1,1]’;
gd= [R1];
sf= ‘R1’;
ns = char(‘R1’);
ns = ns’;
dl = decsg(gd,sf,ns);
%% Create & plot geometry
geometryFromEdges(thermalmodel,dl);
pdegplot(thermalmodel,"EdgeLabels","on","FaceLabels","on")
xlim([0 0.1])
ylim([-1 1])
% axis equal
%% Generate and plot mesh
generateMesh(thermalmodel)
figure
pdemesh(thermalmodel)
title("Mesh with Quadratic Triangular Elements")
%% Apply BCs
% Edge 4 is left edge; Edge 2 is right side
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[4],u=100);
applyBoundaryCondition(thermalmodel, "dirichlet",Edge=[2],u=20);
%% Apply thermal properties [copper]
rho= 8933 %
cp= 385 %
rhocp= rho*cp %
k= 401 % W/mK
%% Define uniform volumetric heat generation rate
Qgen= 0 % W/m3
%% Define coefficients for generic Governing Equation to be solved
m= 0
a= 0
d= rhocp
c= [k]
f= [Qgen]
specifyCoefficients(thermalmodel, m=0, d=rhocp, c=k, a=0, f=f);
%% Apply initial condition
setInitialConditions(thermalmodel, 20);
%% Define time limits
tlist= 0: 1: 10;
thermalresults= solvepde(thermalmodel, tlist);
% Plot results
sol = thermalresults.NodalSolution;
subplot(2,2,1)
pdeplot(thermalmodel,"XYData",sol(:,11), …
"Contour","on",…
"ColorMap","jet") plotting MATLAB Answers — New Questions