Tag Archives: matlab
Match row and column in a number of excel file and return the value in the cell
Hi!
I am trying to process some data located in separate excel files (a few hundred). The files consist raw data directly downloaded from a data base in the form of books/files with export and import data during a period of time.
The actual location in the sheet varies between the documents, meaning it needs to be a solution that searches and find the value in the sheet. Ideally I would like to construct a number of loops that:
Finds the correcponding value that matches a row and a column. F.e the match between the row with name "China" and the column "Exported value in Q4 2015" and return the value (or the cell index).
Locate the value or cell index in question and return the value of it, and the correcponding 3 values on the row in question. If the value is located in C4, I would like to find the total value for C4+ D4+E4+ F4.
The end goal is a loop that search through all files and repeats the procedure above.Hi!
I am trying to process some data located in separate excel files (a few hundred). The files consist raw data directly downloaded from a data base in the form of books/files with export and import data during a period of time.
The actual location in the sheet varies between the documents, meaning it needs to be a solution that searches and find the value in the sheet. Ideally I would like to construct a number of loops that:
Finds the correcponding value that matches a row and a column. F.e the match between the row with name "China" and the column "Exported value in Q4 2015" and return the value (or the cell index).
Locate the value or cell index in question and return the value of it, and the correcponding 3 values on the row in question. If the value is located in C4, I would like to find the total value for C4+ D4+E4+ F4.
The end goal is a loop that search through all files and repeats the procedure above. Hi!
I am trying to process some data located in separate excel files (a few hundred). The files consist raw data directly downloaded from a data base in the form of books/files with export and import data during a period of time.
The actual location in the sheet varies between the documents, meaning it needs to be a solution that searches and find the value in the sheet. Ideally I would like to construct a number of loops that:
Finds the correcponding value that matches a row and a column. F.e the match between the row with name "China" and the column "Exported value in Q4 2015" and return the value (or the cell index).
Locate the value or cell index in question and return the value of it, and the correcponding 3 values on the row in question. If the value is located in C4, I would like to find the total value for C4+ D4+E4+ F4.
The end goal is a loop that search through all files and repeats the procedure above. excel, xls, data management, loops, challenge MATLAB Answers — New Questions
Simulink RT Instrument – How to set maximum amount of data received with getBufferedData() and how to stream each signal?
I use Instrument with buffer mode and simulating random model with Simulink RT.
Here is the code for initializing instrument:
tg = slrealtime(‘TargetPC1’);
removeAllInstruments(tg);
hInst = slrealtime.Instrument(‘test.mldatx’);
hInst.addSignal({‘test/constant_block’}, 1);
hInst.addSignal({‘test/demux_block’}, 1);
hInst.addSignal({‘test/gain_block’}, 1);
hInst.addSignal({‘test/from_block’}, 1);
hInst.BufferData = true;
addInstrument(tg, hInst)
and getting datas while RT simulation is running with:
buffer_map = getBufferedData(hInst);
buffer_values = buffer_map.values
1 – Since the buffer only clears when I use getBufferedData(), If I don’t use this function for a while, it tooks many seconds to get all the data from buffer, but I only need latest data. Therefore, can I only get latest data and shorten the time or can I decrease the buffer size to shorten the time?
2 – I am adding 4 signals above code, outputs of constant, demux, gain and from blocks, but I can only get gain block’s output signal data and I can validate these 3 signals are not added to target instrument by using validate(hInst, ‘test’) and I can see warnings when I try to add them. I think they are optimized because these blocks is just for a connection, not for a mathematical operation. Is there a way to stream all the signals I have added?
I use Python-MATLAB bridge, so I can’t use callback method too.
Thank you for your time,
KaanI use Instrument with buffer mode and simulating random model with Simulink RT.
Here is the code for initializing instrument:
tg = slrealtime(‘TargetPC1’);
removeAllInstruments(tg);
hInst = slrealtime.Instrument(‘test.mldatx’);
hInst.addSignal({‘test/constant_block’}, 1);
hInst.addSignal({‘test/demux_block’}, 1);
hInst.addSignal({‘test/gain_block’}, 1);
hInst.addSignal({‘test/from_block’}, 1);
hInst.BufferData = true;
addInstrument(tg, hInst)
and getting datas while RT simulation is running with:
buffer_map = getBufferedData(hInst);
buffer_values = buffer_map.values
1 – Since the buffer only clears when I use getBufferedData(), If I don’t use this function for a while, it tooks many seconds to get all the data from buffer, but I only need latest data. Therefore, can I only get latest data and shorten the time or can I decrease the buffer size to shorten the time?
2 – I am adding 4 signals above code, outputs of constant, demux, gain and from blocks, but I can only get gain block’s output signal data and I can validate these 3 signals are not added to target instrument by using validate(hInst, ‘test’) and I can see warnings when I try to add them. I think they are optimized because these blocks is just for a connection, not for a mathematical operation. Is there a way to stream all the signals I have added?
I use Python-MATLAB bridge, so I can’t use callback method too.
Thank you for your time,
Kaan I use Instrument with buffer mode and simulating random model with Simulink RT.
Here is the code for initializing instrument:
tg = slrealtime(‘TargetPC1’);
removeAllInstruments(tg);
hInst = slrealtime.Instrument(‘test.mldatx’);
hInst.addSignal({‘test/constant_block’}, 1);
hInst.addSignal({‘test/demux_block’}, 1);
hInst.addSignal({‘test/gain_block’}, 1);
hInst.addSignal({‘test/from_block’}, 1);
hInst.BufferData = true;
addInstrument(tg, hInst)
and getting datas while RT simulation is running with:
buffer_map = getBufferedData(hInst);
buffer_values = buffer_map.values
1 – Since the buffer only clears when I use getBufferedData(), If I don’t use this function for a while, it tooks many seconds to get all the data from buffer, but I only need latest data. Therefore, can I only get latest data and shorten the time or can I decrease the buffer size to shorten the time?
2 – I am adding 4 signals above code, outputs of constant, demux, gain and from blocks, but I can only get gain block’s output signal data and I can validate these 3 signals are not added to target instrument by using validate(hInst, ‘test’) and I can see warnings when I try to add them. I think they are optimized because these blocks is just for a connection, not for a mathematical operation. Is there a way to stream all the signals I have added?
I use Python-MATLAB bridge, so I can’t use callback method too.
Thank you for your time,
Kaan simulink rt, instrument, hil, logging, streaming MATLAB Answers — New Questions
Matlab not launching but continues to start license activation
I have a new PC and have installed Matlab on this, and run the activation. There are no error messages neither during installation, nor the activation. I have together with our IT support institution checked all tips in this page
Why am I continuously prompted to activate when I try to launch MATLAB? – MATLAB Answers – MATLAB Central
but this did not help. We have also tried to uninstall and re-install Matlab, and have also tried to active computed from the license center and do not know what else to proceed.I have a new PC and have installed Matlab on this, and run the activation. There are no error messages neither during installation, nor the activation. I have together with our IT support institution checked all tips in this page
Why am I continuously prompted to activate when I try to launch MATLAB? – MATLAB Answers – MATLAB Central
but this did not help. We have also tried to uninstall and re-install Matlab, and have also tried to active computed from the license center and do not know what else to proceed. I have a new PC and have installed Matlab on this, and run the activation. There are no error messages neither during installation, nor the activation. I have together with our IT support institution checked all tips in this page
Why am I continuously prompted to activate when I try to launch MATLAB? – MATLAB Answers – MATLAB Central
but this did not help. We have also tried to uninstall and re-install Matlab, and have also tried to active computed from the license center and do not know what else to proceed. installation, license activation, r2024b MATLAB Answers — New Questions
cosine of a matrix returns weird values.
I’m trying to plot a few forces that chance because of an angle. I’ve defined the changing angle as beta which is a matrix. Than i’m calcultating two different angles which matter for the calculation of the forces. And for these forces i need, for example, the cosine of angle alpha. The angle of alpha changes between 90 and 0 degrees. But if i take the cosine of this matrix it returns weird numbers. Negative numbers, like -0.4481. It should start at 90 and cosine 90 equals 0 but it doesn’t. Does anyone know what is going on?
Fad = 240
beta = 0:1:180; % Angles
gamma = 180 – beta;
alpha = 0.5.*gamma;
w = cos(alpha); % Cosine and tanges of said angles
x = cos(gamma);
y = tan(alpha);
z = tan(gamma);
Fvloer1 = Fad./w; % Calculations of different forces
Fvloer2 = Fvloer1.*x; % Almost all forces are matrices except for Fad which is a constant.
Fl = Fad.*y;
Ft = Fvloer2.*z;
figure % Plots of these forces against an angle
plot(beta,Fvloer1)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fvloer2)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fl)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Ft)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid onI’m trying to plot a few forces that chance because of an angle. I’ve defined the changing angle as beta which is a matrix. Than i’m calcultating two different angles which matter for the calculation of the forces. And for these forces i need, for example, the cosine of angle alpha. The angle of alpha changes between 90 and 0 degrees. But if i take the cosine of this matrix it returns weird numbers. Negative numbers, like -0.4481. It should start at 90 and cosine 90 equals 0 but it doesn’t. Does anyone know what is going on?
Fad = 240
beta = 0:1:180; % Angles
gamma = 180 – beta;
alpha = 0.5.*gamma;
w = cos(alpha); % Cosine and tanges of said angles
x = cos(gamma);
y = tan(alpha);
z = tan(gamma);
Fvloer1 = Fad./w; % Calculations of different forces
Fvloer2 = Fvloer1.*x; % Almost all forces are matrices except for Fad which is a constant.
Fl = Fad.*y;
Ft = Fvloer2.*z;
figure % Plots of these forces against an angle
plot(beta,Fvloer1)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fvloer2)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fl)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Ft)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on I’m trying to plot a few forces that chance because of an angle. I’ve defined the changing angle as beta which is a matrix. Than i’m calcultating two different angles which matter for the calculation of the forces. And for these forces i need, for example, the cosine of angle alpha. The angle of alpha changes between 90 and 0 degrees. But if i take the cosine of this matrix it returns weird numbers. Negative numbers, like -0.4481. It should start at 90 and cosine 90 equals 0 but it doesn’t. Does anyone know what is going on?
Fad = 240
beta = 0:1:180; % Angles
gamma = 180 – beta;
alpha = 0.5.*gamma;
w = cos(alpha); % Cosine and tanges of said angles
x = cos(gamma);
y = tan(alpha);
z = tan(gamma);
Fvloer1 = Fad./w; % Calculations of different forces
Fvloer2 = Fvloer1.*x; % Almost all forces are matrices except for Fad which is a constant.
Fl = Fad.*y;
Ft = Fvloer2.*z;
figure % Plots of these forces against an angle
plot(beta,Fvloer1)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fvloer2)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Fl)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on
figure
plot(beta,Ft)
xlabel("Hoek [Graden]")
ylabel("Kracht [N ]")
grid on matrices, functions MATLAB Answers — New Questions
Does Matlab FMI export will support operating FMU serialisation function ?
Playing with FMU export with 2020b, I have noticed that serialising and accessing FMU State can be invoked but doing nothing. Is it planned to get those two FMI features (Serialising and GetFMUState) available (operating and not empty shell) in the future ?Playing with FMU export with 2020b, I have noticed that serialising and accessing FMU State can be invoked but doing nothing. Is it planned to get those two FMI features (Serialising and GetFMUState) available (operating and not empty shell) in the future ? Playing with FMU export with 2020b, I have noticed that serialising and accessing FMU State can be invoked but doing nothing. Is it planned to get those two FMI features (Serialising and GetFMUState) available (operating and not empty shell) in the future ? fmi MATLAB Answers — New Questions
Switching elements in 3D image(xy) dataset to export yz and xz images
I am working on (x*y)*z (eg. 300x300x300 pixel) binary image data set that gets imported as a multidimentional array.
For directional open porosity calculation I need to export YZ and XZ images for further calculation
A rough example on the layout(the numbers here would be 0 or 1 in actual data):
M(:,:,1) = [1 2 3; 4 5 6; 7 8 9];
M(:,:,2) = [10 11 12; 13 14 15; 16 17 18];
M(:,:,3) = [19 20 21; 22 23 24; 25 26 27];
for t1=1:size(M,3)
for i1=1:size(M,3)
YZ(i1,:,:)=M(:,:,i1);
end
end
for t2=1:size(M,3)
for i2=1:size(M,3)
XZ(:,t2,:)=M(i2,t2,:);
end
end
This produces the images in the YZ.
YZ(:,:,1) = [1 4 7; 10 13 16; 19 22 25];
YZ(:,:,2) = [2 5 8; 11 14 17; 20 23 26];
YZ(:,:,3) = [3 6 9; 12 15 18; 21 24 27];
I am facing the problem in the XZ planes, the last section produces only the required first page of the multidimentional array
the current output is
7 8 9
16 17 18
25 26 27
The required outout would be something like
XZ(:,:,1) = [7 8 9; 16 17 18; 25 26 27];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [1 2 3; 10 11 12; 19 20 21];
or the reverse
XZ(:,:,1) = [1 2 3; 10 11 12; 19 20 21];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [7 8 9; 16 17 18; 25 26 27];
I saw this question https://nl.mathworks.com/matlabcentral/answers/302683-switch-elements-of-the-2nd-and-3d-dimension-in-3d-matrix
But in my case permute() is not generating the required layout.
Any info would be really helpful!I am working on (x*y)*z (eg. 300x300x300 pixel) binary image data set that gets imported as a multidimentional array.
For directional open porosity calculation I need to export YZ and XZ images for further calculation
A rough example on the layout(the numbers here would be 0 or 1 in actual data):
M(:,:,1) = [1 2 3; 4 5 6; 7 8 9];
M(:,:,2) = [10 11 12; 13 14 15; 16 17 18];
M(:,:,3) = [19 20 21; 22 23 24; 25 26 27];
for t1=1:size(M,3)
for i1=1:size(M,3)
YZ(i1,:,:)=M(:,:,i1);
end
end
for t2=1:size(M,3)
for i2=1:size(M,3)
XZ(:,t2,:)=M(i2,t2,:);
end
end
This produces the images in the YZ.
YZ(:,:,1) = [1 4 7; 10 13 16; 19 22 25];
YZ(:,:,2) = [2 5 8; 11 14 17; 20 23 26];
YZ(:,:,3) = [3 6 9; 12 15 18; 21 24 27];
I am facing the problem in the XZ planes, the last section produces only the required first page of the multidimentional array
the current output is
7 8 9
16 17 18
25 26 27
The required outout would be something like
XZ(:,:,1) = [7 8 9; 16 17 18; 25 26 27];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [1 2 3; 10 11 12; 19 20 21];
or the reverse
XZ(:,:,1) = [1 2 3; 10 11 12; 19 20 21];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [7 8 9; 16 17 18; 25 26 27];
I saw this question https://nl.mathworks.com/matlabcentral/answers/302683-switch-elements-of-the-2nd-and-3d-dimension-in-3d-matrix
But in my case permute() is not generating the required layout.
Any info would be really helpful! I am working on (x*y)*z (eg. 300x300x300 pixel) binary image data set that gets imported as a multidimentional array.
For directional open porosity calculation I need to export YZ and XZ images for further calculation
A rough example on the layout(the numbers here would be 0 or 1 in actual data):
M(:,:,1) = [1 2 3; 4 5 6; 7 8 9];
M(:,:,2) = [10 11 12; 13 14 15; 16 17 18];
M(:,:,3) = [19 20 21; 22 23 24; 25 26 27];
for t1=1:size(M,3)
for i1=1:size(M,3)
YZ(i1,:,:)=M(:,:,i1);
end
end
for t2=1:size(M,3)
for i2=1:size(M,3)
XZ(:,t2,:)=M(i2,t2,:);
end
end
This produces the images in the YZ.
YZ(:,:,1) = [1 4 7; 10 13 16; 19 22 25];
YZ(:,:,2) = [2 5 8; 11 14 17; 20 23 26];
YZ(:,:,3) = [3 6 9; 12 15 18; 21 24 27];
I am facing the problem in the XZ planes, the last section produces only the required first page of the multidimentional array
the current output is
7 8 9
16 17 18
25 26 27
The required outout would be something like
XZ(:,:,1) = [7 8 9; 16 17 18; 25 26 27];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [1 2 3; 10 11 12; 19 20 21];
or the reverse
XZ(:,:,1) = [1 2 3; 10 11 12; 19 20 21];
XZ(:,:,2) = [4 5 6; 13 14 15; 22 23 24];
XZ(:,:,3) = [7 8 9; 16 17 18; 25 26 27];
I saw this question https://nl.mathworks.com/matlabcentral/answers/302683-switch-elements-of-the-2nd-and-3d-dimension-in-3d-matrix
But in my case permute() is not generating the required layout.
Any info would be really helpful! image processing, matrix array, matrix manipulation MATLAB Answers — New Questions
PX4 test connection accelerometer data error
in the test connection part after successful upload firmware I am not able to read accelerometer value as in the picture below
NOTE:
I got this error with
(1)Design Flight Controller Algorithm in Simulink (both rcS and rc.txt methods)
(2) Design Path Follower Algorithm in Simulink
(3) QGC is working
(4) MatLab 2021b/ Pixhawk 1 (v2)
(5) with matlab 2019b and px4_cygwin toolchian v.05 it worked.
any solution to this with matlab 2021bin the test connection part after successful upload firmware I am not able to read accelerometer value as in the picture below
NOTE:
I got this error with
(1)Design Flight Controller Algorithm in Simulink (both rcS and rc.txt methods)
(2) Design Path Follower Algorithm in Simulink
(3) QGC is working
(4) MatLab 2021b/ Pixhawk 1 (v2)
(5) with matlab 2019b and px4_cygwin toolchian v.05 it worked.
any solution to this with matlab 2021b in the test connection part after successful upload firmware I am not able to read accelerometer value as in the picture below
NOTE:
I got this error with
(1)Design Flight Controller Algorithm in Simulink (both rcS and rc.txt methods)
(2) Design Path Follower Algorithm in Simulink
(3) QGC is working
(4) MatLab 2021b/ Pixhawk 1 (v2)
(5) with matlab 2019b and px4_cygwin toolchian v.05 it worked.
any solution to this with matlab 2021b px4, uav MATLAB Answers — New Questions
GA multi-objective optmization
I’m impelementing GA using matlab optimization toolbox.
I have 6 Variables which one them only accepts integer values. I read the optimization options but I couldn’t find a solution for my problem. I would appreciate your help.
FitnessFunction = @objFuns;
numberOfVariables = 6;
options = optimoptions(‘gamultiobj’);
LB = [2 4 55 38 1 1.8];
UB = [25 10 70 49 6 4];
A = []; % No linear inequality constraints
b = []; % No linear inequality constraints
Aeq = []; % No linear equality constraints
beq = []; % No linear equality constraints
[x,Fval,exitFlag,Output] = gamultiobj(FitnessFunction,numberOfVariables,…
A,b,Aeq,beq,…
LB,UB,[],options);I’m impelementing GA using matlab optimization toolbox.
I have 6 Variables which one them only accepts integer values. I read the optimization options but I couldn’t find a solution for my problem. I would appreciate your help.
FitnessFunction = @objFuns;
numberOfVariables = 6;
options = optimoptions(‘gamultiobj’);
LB = [2 4 55 38 1 1.8];
UB = [25 10 70 49 6 4];
A = []; % No linear inequality constraints
b = []; % No linear inequality constraints
Aeq = []; % No linear equality constraints
beq = []; % No linear equality constraints
[x,Fval,exitFlag,Output] = gamultiobj(FitnessFunction,numberOfVariables,…
A,b,Aeq,beq,…
LB,UB,[],options); I’m impelementing GA using matlab optimization toolbox.
I have 6 Variables which one them only accepts integer values. I read the optimization options but I couldn’t find a solution for my problem. I would appreciate your help.
FitnessFunction = @objFuns;
numberOfVariables = 6;
options = optimoptions(‘gamultiobj’);
LB = [2 4 55 38 1 1.8];
UB = [25 10 70 49 6 4];
A = []; % No linear inequality constraints
b = []; % No linear inequality constraints
Aeq = []; % No linear equality constraints
beq = []; % No linear equality constraints
[x,Fval,exitFlag,Output] = gamultiobj(FitnessFunction,numberOfVariables,…
A,b,Aeq,beq,…
LB,UB,[],options); ga, optimization MATLAB Answers — New Questions
How to find lines that intersect at least 3 different points on Y axes with 2 % error range?
I have time series data which consists of the time and closing prices of a stock. To automatically find trend (or trend like) lines I tried best fit – poly fit (polyfit(x,y,1)). As it is known, lines passing through 3 or more points are considered as trend lines financially and these points must be the lows or highs in the data set. So to be able to find local lows/highs IsChange() function which finds abrupt changes in data seems to be useful. The problem is that after finding local highs (or lows) how to find a line/lines that at least intersect 3 different points with max. 2% error range? Thanks.I have time series data which consists of the time and closing prices of a stock. To automatically find trend (or trend like) lines I tried best fit – poly fit (polyfit(x,y,1)). As it is known, lines passing through 3 or more points are considered as trend lines financially and these points must be the lows or highs in the data set. So to be able to find local lows/highs IsChange() function which finds abrupt changes in data seems to be useful. The problem is that after finding local highs (or lows) how to find a line/lines that at least intersect 3 different points with max. 2% error range? Thanks. I have time series data which consists of the time and closing prices of a stock. To automatically find trend (or trend like) lines I tried best fit – poly fit (polyfit(x,y,1)). As it is known, lines passing through 3 or more points are considered as trend lines financially and these points must be the lows or highs in the data set. So to be able to find local lows/highs IsChange() function which finds abrupt changes in data seems to be useful. The problem is that after finding local highs (or lows) how to find a line/lines that at least intersect 3 different points with max. 2% error range? Thanks. interpolation, curve fitting, line, best fit, trend MATLAB Answers — New Questions
Can FastDDS communicate with RTIDDS?
hello,I have been using DDS deployed on the Speedgoat for communication recently, and the DDS Blockset documentation says that Simulink Real-Time only supports Eprosima’s FastDDS, but we need to communicate with RTIDDS on the Speedgoat. When I tested communication between two computers running Simulink (not Simulink Real-Time) and found that FastDDS can communicate with each other, RTIDDS can also communicate with each other, but FastDDS and RTIDDS cannot communicate, and there is an error when communicating between the Speedgoat and RTIDDS.hello,I have been using DDS deployed on the Speedgoat for communication recently, and the DDS Blockset documentation says that Simulink Real-Time only supports Eprosima’s FastDDS, but we need to communicate with RTIDDS on the Speedgoat. When I tested communication between two computers running Simulink (not Simulink Real-Time) and found that FastDDS can communicate with each other, RTIDDS can also communicate with each other, but FastDDS and RTIDDS cannot communicate, and there is an error when communicating between the Speedgoat and RTIDDS. hello,I have been using DDS deployed on the Speedgoat for communication recently, and the DDS Blockset documentation says that Simulink Real-Time only supports Eprosima’s FastDDS, but we need to communicate with RTIDDS on the Speedgoat. When I tested communication between two computers running Simulink (not Simulink Real-Time) and found that FastDDS can communicate with each other, RTIDDS can also communicate with each other, but FastDDS and RTIDDS cannot communicate, and there is an error when communicating between the Speedgoat and RTIDDS. simulink MATLAB Answers — New Questions
Simscape AC Current Source issue
Hello Community,
I would like to simulate a street with Simscape, and i wanted to use a AC current source to supply from residents. As i learned it is the same issue with the simple AC Voltage Source, that even i use 3 phase breaker at both side, and wswitehced off, during the simulatin the status of the breaker is not relevant.
This is the subsystem is use:
There is the two 3 phase breaker (I iknow it is not necessary, but i dont have other idea), what is by default closed.
When i make a simulation with both breaker open status:
The value of the current is added even it is switched off. This should be the values, when the breakers are open ( i delete the 3 AC cource):
Every section i made an option to break the line, so i did it to see, and the result is, that even the breakers are in open position, it is still count:
Other, that i tried with closed breakers, and nothing change, therefore i think is is an issue with the calculation.
Do anybody have any idea what is goint on?
Thanks.
PS: The model works more less with the controlled AC source, but it is changing even i set the designated AC Current, SO therefore i would like to try another source.Hello Community,
I would like to simulate a street with Simscape, and i wanted to use a AC current source to supply from residents. As i learned it is the same issue with the simple AC Voltage Source, that even i use 3 phase breaker at both side, and wswitehced off, during the simulatin the status of the breaker is not relevant.
This is the subsystem is use:
There is the two 3 phase breaker (I iknow it is not necessary, but i dont have other idea), what is by default closed.
When i make a simulation with both breaker open status:
The value of the current is added even it is switched off. This should be the values, when the breakers are open ( i delete the 3 AC cource):
Every section i made an option to break the line, so i did it to see, and the result is, that even the breakers are in open position, it is still count:
Other, that i tried with closed breakers, and nothing change, therefore i think is is an issue with the calculation.
Do anybody have any idea what is goint on?
Thanks.
PS: The model works more less with the controlled AC source, but it is changing even i set the designated AC Current, SO therefore i would like to try another source. Hello Community,
I would like to simulate a street with Simscape, and i wanted to use a AC current source to supply from residents. As i learned it is the same issue with the simple AC Voltage Source, that even i use 3 phase breaker at both side, and wswitehced off, during the simulatin the status of the breaker is not relevant.
This is the subsystem is use:
There is the two 3 phase breaker (I iknow it is not necessary, but i dont have other idea), what is by default closed.
When i make a simulation with both breaker open status:
The value of the current is added even it is switched off. This should be the values, when the breakers are open ( i delete the 3 AC cource):
Every section i made an option to break the line, so i did it to see, and the result is, that even the breakers are in open position, it is still count:
Other, that i tried with closed breakers, and nothing change, therefore i think is is an issue with the calculation.
Do anybody have any idea what is goint on?
Thanks.
PS: The model works more less with the controlled AC source, but it is changing even i set the designated AC Current, SO therefore i would like to try another source. simscape, specialized power systems MATLAB Answers — New Questions
Transpose SQL code into MATLAB
Hi,
I have an SQL query that is ok in Workbench, the results are I expected:
SELECT * FROM prices.prices WHERE (Var5 <= 125 and Var5 >= 124 OR Var6 <= 125 and Var6 >= 124 OR Var7 <= 125 and Var7 >= 124) AND (Var8 <= 6 and Var8 >= 5 OR Product <= 6 and Product >= 5 OR Var10 <= 6 and Var10 >= 5);
In Matlab I want to do a query in data base, based on 4 variables 2 min and 2 max values that search in 6 different columns . For only 2 variables min and max value work perfectly but if I add the other two variables to extend the selection in other three columns it failed to show wanted results.
This is the half working:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1];
And full code:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1 ‘ AND Var8 <= ‘,caseta4 ‘ and Var8 >= ‘,caseta3 ‘ OR Product <= ‘,caseta4 ‘ and Product >= ‘,caseta3 ‘ OR Var10 <= ‘,caseta4 ‘ and Var10 >= ‘,caseta3 ];
selectie = fetch(conn,sqlquery);
In the Workbench I could used paranthesis and "AND" between criteria but in Matlab I don’t know how to use itHi,
I have an SQL query that is ok in Workbench, the results are I expected:
SELECT * FROM prices.prices WHERE (Var5 <= 125 and Var5 >= 124 OR Var6 <= 125 and Var6 >= 124 OR Var7 <= 125 and Var7 >= 124) AND (Var8 <= 6 and Var8 >= 5 OR Product <= 6 and Product >= 5 OR Var10 <= 6 and Var10 >= 5);
In Matlab I want to do a query in data base, based on 4 variables 2 min and 2 max values that search in 6 different columns . For only 2 variables min and max value work perfectly but if I add the other two variables to extend the selection in other three columns it failed to show wanted results.
This is the half working:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1];
And full code:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1 ‘ AND Var8 <= ‘,caseta4 ‘ and Var8 >= ‘,caseta3 ‘ OR Product <= ‘,caseta4 ‘ and Product >= ‘,caseta3 ‘ OR Var10 <= ‘,caseta4 ‘ and Var10 >= ‘,caseta3 ];
selectie = fetch(conn,sqlquery);
In the Workbench I could used paranthesis and "AND" between criteria but in Matlab I don’t know how to use it Hi,
I have an SQL query that is ok in Workbench, the results are I expected:
SELECT * FROM prices.prices WHERE (Var5 <= 125 and Var5 >= 124 OR Var6 <= 125 and Var6 >= 124 OR Var7 <= 125 and Var7 >= 124) AND (Var8 <= 6 and Var8 >= 5 OR Product <= 6 and Product >= 5 OR Var10 <= 6 and Var10 >= 5);
In Matlab I want to do a query in data base, based on 4 variables 2 min and 2 max values that search in 6 different columns . For only 2 variables min and max value work perfectly but if I add the other two variables to extend the selection in other three columns it failed to show wanted results.
This is the half working:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1];
And full code:
sqlquery = [‘SELECT * FROM prices.prices WHERE Var5 <= ‘,caseta2 ‘ and Var5 >= ‘,caseta1 ‘ OR Var6 <= ‘,caseta2 ‘ and Var6 >= ‘,caseta1 ‘ OR Var7 <= ‘,caseta2 ‘ and Var7 >= ‘,caseta1 ‘ AND Var8 <= ‘,caseta4 ‘ and Var8 >= ‘,caseta3 ‘ OR Product <= ‘,caseta4 ‘ and Product >= ‘,caseta3 ‘ OR Var10 <= ‘,caseta4 ‘ and Var10 >= ‘,caseta3 ];
selectie = fetch(conn,sqlquery);
In the Workbench I could used paranthesis and "AND" between criteria but in Matlab I don’t know how to use it sql, matlab, criteria, search MATLAB Answers — New Questions
Converting product into individual entries
Can I write [4*3 5 7*0 11 3*9] in the following format.
[3,3,3,3,5,0,0,0,0,0,0,0,11,9,9,9]Can I write [4*3 5 7*0 11 3*9] in the following format.
[3,3,3,3,5,0,0,0,0,0,0,0,11,9,9,9] Can I write [4*3 5 7*0 11 3*9] in the following format.
[3,3,3,3,5,0,0,0,0,0,0,0,11,9,9,9] matlab MATLAB Answers — New Questions
How do I solve this IndexError in ONNX Model Predict block?
I created this kind of a sample Simulink model with ONNX Model Predict.
I want to run the simulation with my simple ONNX model that I created with Pytorch.
Also I set Input and output tab of the block parameter like the below images.
Input tab
Output tab
then I run the simulation however I got this error.
Despite the same count of Input to ONNX model, this happens…
Does this ring a bell? I could figure out where I am missing…
I’d appreciate it if you could give me your advice. How do I solve?
MATLAB System block ‘untitled/ONNX Model Predict/ONNX Model Block’ error when calling ‘getOutputSizeImpl’ method of
‘nnet.pycoexblks.
Call to the Python model predict() function ‘py.ONNXModelBlock.predict(…)’ failed.
The Python error message is: == START OF PYTHON ERROR MESSAGE ==
Python error: IndexError: list index out of range
== END OF PYTHON ERROR MESSAGE ==.
Terminal width or dimension error.
‘ Output Terminal 1’ in ‘untitled/ONNX Model Predict/In7’ is a 1-dimensional vector with 1 element.
My python code to create simple onnx model (Pytorch)
This is how I created my ONNX model. I just first wanted to try with easy way.
import torch
import torch.nn as nn
class EmptyModel(nn.Module):
def __init__(self):
super(EmptyModel, self).__init__()
# No trainable parameters, but add a linear layer to match Simulink requirements
self.linear = nn.Linear(7, 2, bias=False)
with torch.no_grad():
self.linear.weight.fill_(0.0)
def forward(self, x):
# Returns the first two elements of the input as is, without any computation
return x[:, :2]
model = EmptyModel()
dummy_input = torch.randn(1, 7, dtype=torch.float32)
torch.onnx.export(
model,
dummy_input,
"empty_model.onnx",
export_params=True,
opset_version=11,
do_constant_folding=True,
input_names=["input"],
output_names=["output"],
dynamic_axes={
"input": {0: "batch_size"},
"output": {0: "batch_size"},
},
)
Sorry that Japansene is included in my attached images…
I look forward to your answer.
Best,I created this kind of a sample Simulink model with ONNX Model Predict.
I want to run the simulation with my simple ONNX model that I created with Pytorch.
Also I set Input and output tab of the block parameter like the below images.
Input tab
Output tab
then I run the simulation however I got this error.
Despite the same count of Input to ONNX model, this happens…
Does this ring a bell? I could figure out where I am missing…
I’d appreciate it if you could give me your advice. How do I solve?
MATLAB System block ‘untitled/ONNX Model Predict/ONNX Model Block’ error when calling ‘getOutputSizeImpl’ method of
‘nnet.pycoexblks.
Call to the Python model predict() function ‘py.ONNXModelBlock.predict(…)’ failed.
The Python error message is: == START OF PYTHON ERROR MESSAGE ==
Python error: IndexError: list index out of range
== END OF PYTHON ERROR MESSAGE ==.
Terminal width or dimension error.
‘ Output Terminal 1’ in ‘untitled/ONNX Model Predict/In7’ is a 1-dimensional vector with 1 element.
My python code to create simple onnx model (Pytorch)
This is how I created my ONNX model. I just first wanted to try with easy way.
import torch
import torch.nn as nn
class EmptyModel(nn.Module):
def __init__(self):
super(EmptyModel, self).__init__()
# No trainable parameters, but add a linear layer to match Simulink requirements
self.linear = nn.Linear(7, 2, bias=False)
with torch.no_grad():
self.linear.weight.fill_(0.0)
def forward(self, x):
# Returns the first two elements of the input as is, without any computation
return x[:, :2]
model = EmptyModel()
dummy_input = torch.randn(1, 7, dtype=torch.float32)
torch.onnx.export(
model,
dummy_input,
"empty_model.onnx",
export_params=True,
opset_version=11,
do_constant_folding=True,
input_names=["input"],
output_names=["output"],
dynamic_axes={
"input": {0: "batch_size"},
"output": {0: "batch_size"},
},
)
Sorry that Japansene is included in my attached images…
I look forward to your answer.
Best, I created this kind of a sample Simulink model with ONNX Model Predict.
I want to run the simulation with my simple ONNX model that I created with Pytorch.
Also I set Input and output tab of the block parameter like the below images.
Input tab
Output tab
then I run the simulation however I got this error.
Despite the same count of Input to ONNX model, this happens…
Does this ring a bell? I could figure out where I am missing…
I’d appreciate it if you could give me your advice. How do I solve?
MATLAB System block ‘untitled/ONNX Model Predict/ONNX Model Block’ error when calling ‘getOutputSizeImpl’ method of
‘nnet.pycoexblks.
Call to the Python model predict() function ‘py.ONNXModelBlock.predict(…)’ failed.
The Python error message is: == START OF PYTHON ERROR MESSAGE ==
Python error: IndexError: list index out of range
== END OF PYTHON ERROR MESSAGE ==.
Terminal width or dimension error.
‘ Output Terminal 1’ in ‘untitled/ONNX Model Predict/In7’ is a 1-dimensional vector with 1 element.
My python code to create simple onnx model (Pytorch)
This is how I created my ONNX model. I just first wanted to try with easy way.
import torch
import torch.nn as nn
class EmptyModel(nn.Module):
def __init__(self):
super(EmptyModel, self).__init__()
# No trainable parameters, but add a linear layer to match Simulink requirements
self.linear = nn.Linear(7, 2, bias=False)
with torch.no_grad():
self.linear.weight.fill_(0.0)
def forward(self, x):
# Returns the first two elements of the input as is, without any computation
return x[:, :2]
model = EmptyModel()
dummy_input = torch.randn(1, 7, dtype=torch.float32)
torch.onnx.export(
model,
dummy_input,
"empty_model.onnx",
export_params=True,
opset_version=11,
do_constant_folding=True,
input_names=["input"],
output_names=["output"],
dynamic_axes={
"input": {0: "batch_size"},
"output": {0: "batch_size"},
},
)
Sorry that Japansene is included in my attached images…
I look forward to your answer.
Best, onnx, deep learning MATLAB Answers — New Questions
regionZoomInteraction only works the first time, bug?
So I noticed this very weird thing which I think is a bug…
When the switch is on by default, the regionZoom works as intended. Then I turn it off, and rotate and zoom starts to work. And turn it on again, now the regionZoom cursor shows, you can select the area, but it doesn’t actually zoom.
It looks like regionZoom only works in the first instance. Second time onwards it doesn’t work. ZoomInteraction still works and this issue only applies to regionZoom.
Any thoughts? Can I add regionZoom as a standard option in the axes toolbar? That would do the job too.
function ButtonPushed(app, event)
ax=app.UIAxes;
if app.Switch.Value == "Off"
ax.Interactions = [rotateInteraction zoomInteraction];
else
ax.Interactions = [regionZoomInteraction zoomInteraction] ;
endSo I noticed this very weird thing which I think is a bug…
When the switch is on by default, the regionZoom works as intended. Then I turn it off, and rotate and zoom starts to work. And turn it on again, now the regionZoom cursor shows, you can select the area, but it doesn’t actually zoom.
It looks like regionZoom only works in the first instance. Second time onwards it doesn’t work. ZoomInteraction still works and this issue only applies to regionZoom.
Any thoughts? Can I add regionZoom as a standard option in the axes toolbar? That would do the job too.
function ButtonPushed(app, event)
ax=app.UIAxes;
if app.Switch.Value == "Off"
ax.Interactions = [rotateInteraction zoomInteraction];
else
ax.Interactions = [regionZoomInteraction zoomInteraction] ;
end So I noticed this very weird thing which I think is a bug…
When the switch is on by default, the regionZoom works as intended. Then I turn it off, and rotate and zoom starts to work. And turn it on again, now the regionZoom cursor shows, you can select the area, but it doesn’t actually zoom.
It looks like regionZoom only works in the first instance. Second time onwards it doesn’t work. ZoomInteraction still works and this issue only applies to regionZoom.
Any thoughts? Can I add regionZoom as a standard option in the axes toolbar? That would do the job too.
function ButtonPushed(app, event)
ax=app.UIAxes;
if app.Switch.Value == "Off"
ax.Interactions = [rotateInteraction zoomInteraction];
else
ax.Interactions = [regionZoomInteraction zoomInteraction] ;
end 3d plots MATLAB Answers — New Questions
Replace FMU and reload it in the FMU block in Simulink
Hello everyone,
I have the following problem: I have added an FMU import block to my Simulink model and imported my FMU by specifying the path of the FMU. The simulation in Simulink with the FMU works so far. However, if I make changes in the external simulation software (I am not talking about parameters that I could change directly in Simulink) and replace the existing FMU in the Matlab path with a new one (with the same name), the FMU block in Simulink do not see the changes, even though they appear in the corresponding xml file. I can still simulate with the FMU, but changes in parameter values between the two FMU files are apparently not taken into account. The changes only take effect if I delete the existing FMU block in Simulink, create a new one and load the last FMU I created.
Are the parameters in the FMU block cached somewhere that the FMU block accesses? I have already tried to update the model, but it does not help.Is there any other way, some kind of reset command for the FMU Block, to reload the stored FMU? Since I am planning to automate the simulation, I would like to avoid having to delete the FMU Block and add a new one after each new FMU is created.
Many thanks in advance!Hello everyone,
I have the following problem: I have added an FMU import block to my Simulink model and imported my FMU by specifying the path of the FMU. The simulation in Simulink with the FMU works so far. However, if I make changes in the external simulation software (I am not talking about parameters that I could change directly in Simulink) and replace the existing FMU in the Matlab path with a new one (with the same name), the FMU block in Simulink do not see the changes, even though they appear in the corresponding xml file. I can still simulate with the FMU, but changes in parameter values between the two FMU files are apparently not taken into account. The changes only take effect if I delete the existing FMU block in Simulink, create a new one and load the last FMU I created.
Are the parameters in the FMU block cached somewhere that the FMU block accesses? I have already tried to update the model, but it does not help.Is there any other way, some kind of reset command for the FMU Block, to reload the stored FMU? Since I am planning to automate the simulation, I would like to avoid having to delete the FMU Block and add a new one after each new FMU is created.
Many thanks in advance! Hello everyone,
I have the following problem: I have added an FMU import block to my Simulink model and imported my FMU by specifying the path of the FMU. The simulation in Simulink with the FMU works so far. However, if I make changes in the external simulation software (I am not talking about parameters that I could change directly in Simulink) and replace the existing FMU in the Matlab path with a new one (with the same name), the FMU block in Simulink do not see the changes, even though they appear in the corresponding xml file. I can still simulate with the FMU, but changes in parameter values between the two FMU files are apparently not taken into account. The changes only take effect if I delete the existing FMU block in Simulink, create a new one and load the last FMU I created.
Are the parameters in the FMU block cached somewhere that the FMU block accesses? I have already tried to update the model, but it does not help.Is there any other way, some kind of reset command for the FMU Block, to reload the stored FMU? Since I am planning to automate the simulation, I would like to avoid having to delete the FMU Block and add a new one after each new FMU is created.
Many thanks in advance! fmu, fmu import MATLAB Answers — New Questions
Issues with SIL Implementation and CCS Integration for AM263P4 using MATLAB Simulink and Embedded Coder
I’m using an AM263P4 control card with MATLAB Simulink (R2024b Update 3) and the Embedded Coder Hardware Support Package for TI AM26x Processors (v24.2.0.12). I can successfully build and deploy to hardware, but unable to import the generated C code into Code Composer Studio (CCS). And the debug option is disabled, and I can’t run or debug for manually added generated code folder to workspace.
To bypass this, I attempted Software-in-the-Loop (SIL) implementation. The build succeeded after updating the build configuration to specify and including GPIO driver paths in Custom Code -> Include Directories. However, during simulation, I encounter undefined reference errors for GPIO functions (e.g., GPIO_setDirMode), suggesting missing or unlinked drivers required for simulation. I tried manually linking libraries, but the issue persists.
Error message:
build summary:
0 of 1 models built (1 models already up to date) Build duration: 0h 0m 3.6275s
Simulation
### Preparing to start SIL simulation … ### Using toolchain: MinGW64 | gmake (64-bit Windows) ### Creating ‘E:QsyncTestfrCCS1_ert_rtwsilTestfrCCS1.mk’ … ### Building ‘TestfrCCS1’: "$(MINGW_ROOT)mingw32-make.exe" -j 6 -l 6 -Oline -f TestfrCCS1.mk all
(…………..few more lines and then…….)
"### Creating standalone executable "./TestfrCCS1.exe" …" "C:PROGRA~3MATLABSUPPOR~1R2024b3P778C~1.INSMINGW_~1.INSbin/g++" -static -m64 -o ./TestfrCCS1.exe @TestfrCCS1.rsp -Wl,–start-group @TestfrCCS1_ref.rsp E:/Qsync/TestfrCCS1_ert_rtw/coderassumptions/pwslib/TestfrCCS1_ca.lib -Wl,–end-group -lws2_32 hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x243): undefined reference to `GPIO_setDirMode’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x261): undefined reference to `GPIO_setTrigType’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x286): undefined reference to `GPIO_bankIntrEnable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x320): undefined reference to `GPIO_bankIntrDisable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x33a): undefined reference to `GPIO_setTrigType’ collect2.exe: error: ld returned 1 exit status mingw32-make: *** [TestfrCCS1.mk:305: TestfrCCS1.exe] Error 1 E:QsyncTestfrCCS1_ert_rtwsil>echo The make command returned an error of 2 The make command returned an error of 2 E:QsyncTestfrCCS1_ert_rtwsil>exit /B 1
An error occurred while calling the SIL or PIL target connectivity implementation.
Caused by:
Error(s) encountered while building "TestfrCCS1"I’m using an AM263P4 control card with MATLAB Simulink (R2024b Update 3) and the Embedded Coder Hardware Support Package for TI AM26x Processors (v24.2.0.12). I can successfully build and deploy to hardware, but unable to import the generated C code into Code Composer Studio (CCS). And the debug option is disabled, and I can’t run or debug for manually added generated code folder to workspace.
To bypass this, I attempted Software-in-the-Loop (SIL) implementation. The build succeeded after updating the build configuration to specify and including GPIO driver paths in Custom Code -> Include Directories. However, during simulation, I encounter undefined reference errors for GPIO functions (e.g., GPIO_setDirMode), suggesting missing or unlinked drivers required for simulation. I tried manually linking libraries, but the issue persists.
Error message:
build summary:
0 of 1 models built (1 models already up to date) Build duration: 0h 0m 3.6275s
Simulation
### Preparing to start SIL simulation … ### Using toolchain: MinGW64 | gmake (64-bit Windows) ### Creating ‘E:QsyncTestfrCCS1_ert_rtwsilTestfrCCS1.mk’ … ### Building ‘TestfrCCS1’: "$(MINGW_ROOT)mingw32-make.exe" -j 6 -l 6 -Oline -f TestfrCCS1.mk all
(…………..few more lines and then…….)
"### Creating standalone executable "./TestfrCCS1.exe" …" "C:PROGRA~3MATLABSUPPOR~1R2024b3P778C~1.INSMINGW_~1.INSbin/g++" -static -m64 -o ./TestfrCCS1.exe @TestfrCCS1.rsp -Wl,–start-group @TestfrCCS1_ref.rsp E:/Qsync/TestfrCCS1_ert_rtw/coderassumptions/pwslib/TestfrCCS1_ca.lib -Wl,–end-group -lws2_32 hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x243): undefined reference to `GPIO_setDirMode’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x261): undefined reference to `GPIO_setTrigType’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x286): undefined reference to `GPIO_bankIntrEnable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x320): undefined reference to `GPIO_bankIntrDisable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x33a): undefined reference to `GPIO_setTrigType’ collect2.exe: error: ld returned 1 exit status mingw32-make: *** [TestfrCCS1.mk:305: TestfrCCS1.exe] Error 1 E:QsyncTestfrCCS1_ert_rtwsil>echo The make command returned an error of 2 The make command returned an error of 2 E:QsyncTestfrCCS1_ert_rtwsil>exit /B 1
An error occurred while calling the SIL or PIL target connectivity implementation.
Caused by:
Error(s) encountered while building "TestfrCCS1" I’m using an AM263P4 control card with MATLAB Simulink (R2024b Update 3) and the Embedded Coder Hardware Support Package for TI AM26x Processors (v24.2.0.12). I can successfully build and deploy to hardware, but unable to import the generated C code into Code Composer Studio (CCS). And the debug option is disabled, and I can’t run or debug for manually added generated code folder to workspace.
To bypass this, I attempted Software-in-the-Loop (SIL) implementation. The build succeeded after updating the build configuration to specify and including GPIO driver paths in Custom Code -> Include Directories. However, during simulation, I encounter undefined reference errors for GPIO functions (e.g., GPIO_setDirMode), suggesting missing or unlinked drivers required for simulation. I tried manually linking libraries, but the issue persists.
Error message:
build summary:
0 of 1 models built (1 models already up to date) Build duration: 0h 0m 3.6275s
Simulation
### Preparing to start SIL simulation … ### Using toolchain: MinGW64 | gmake (64-bit Windows) ### Creating ‘E:QsyncTestfrCCS1_ert_rtwsilTestfrCCS1.mk’ … ### Building ‘TestfrCCS1’: "$(MINGW_ROOT)mingw32-make.exe" -j 6 -l 6 -Oline -f TestfrCCS1.mk all
(…………..few more lines and then…….)
"### Creating standalone executable "./TestfrCCS1.exe" …" "C:PROGRA~3MATLABSUPPOR~1R2024b3P778C~1.INSMINGW_~1.INSbin/g++" -static -m64 -o ./TestfrCCS1.exe @TestfrCCS1.rsp -Wl,–start-group @TestfrCCS1_ref.rsp E:/Qsync/TestfrCCS1_ert_rtw/coderassumptions/pwslib/TestfrCCS1_ca.lib -Wl,–end-group -lws2_32 hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x243): undefined reference to `GPIO_setDirMode’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x261): undefined reference to `GPIO_setTrigType’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x286): undefined reference to `GPIO_bankIntrEnable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x320): undefined reference to `GPIO_bankIntrDisable’ hostobj/MW_GPIOOUT.obj:MW_GPIOOUT.c:(.text+0x33a): undefined reference to `GPIO_setTrigType’ collect2.exe: error: ld returned 1 exit status mingw32-make: *** [TestfrCCS1.mk:305: TestfrCCS1.exe] Error 1 E:QsyncTestfrCCS1_ert_rtwsil>echo The make command returned an error of 2 The make command returned an error of 2 E:QsyncTestfrCCS1_ert_rtwsil>exit /B 1
An error occurred while calling the SIL or PIL target connectivity implementation.
Caused by:
Error(s) encountered while building "TestfrCCS1" simulink, sitara, embedded coder MATLAB Answers — New Questions
FOC PMSM with Hall Sensor Queries
Dear Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for my motor control application using FOC FOR IPMSM. I am stuck with below queries.
PI Controller: How to decide saturation upper(1) and lower(-1) limits values?
How to decide D-Q Limiter block saturation limit value?
PWM Duty cycle not changing after changing referance speed.
Wrap on overflow error. "Current Control/Input Scaling/Read_Sensor (sim)/Subsystem/Speed Measurement/PositionToCount’
Torque-speed characteristics: For my application V=60V, I=48A,Torque=20Nm. After updating motor parameters, I am not getting expected values on graph.(Attached snapshot for ref.)
mcb_getCharacteristics: Are values shown in graph are in PU_System units or SI units. Please clarify.
Thanks in Advance.
.Dear Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for my motor control application using FOC FOR IPMSM. I am stuck with below queries.
PI Controller: How to decide saturation upper(1) and lower(-1) limits values?
How to decide D-Q Limiter block saturation limit value?
PWM Duty cycle not changing after changing referance speed.
Wrap on overflow error. "Current Control/Input Scaling/Read_Sensor (sim)/Subsystem/Speed Measurement/PositionToCount’
Torque-speed characteristics: For my application V=60V, I=48A,Torque=20Nm. After updating motor parameters, I am not getting expected values on graph.(Attached snapshot for ref.)
mcb_getCharacteristics: Are values shown in graph are in PU_System units or SI units. Please clarify.
Thanks in Advance.
. Dear Community,
I am refering https://in.mathworks.com/help/mcb/gs/foc-pmsm-using-hall-sensor-example.html for my motor control application using FOC FOR IPMSM. I am stuck with below queries.
PI Controller: How to decide saturation upper(1) and lower(-1) limits values?
How to decide D-Q Limiter block saturation limit value?
PWM Duty cycle not changing after changing referance speed.
Wrap on overflow error. "Current Control/Input Scaling/Read_Sensor (sim)/Subsystem/Speed Measurement/PositionToCount’
Torque-speed characteristics: For my application V=60V, I=48A,Torque=20Nm. After updating motor parameters, I am not getting expected values on graph.(Attached snapshot for ref.)
mcb_getCharacteristics: Are values shown in graph are in PU_System units or SI units. Please clarify.
Thanks in Advance.
. foc, pmsm, pi controller, pwm duty cycle MATLAB Answers — New Questions
multivariate random numbers generation
How to generate multivariate random number normally distributed in simulink?
The mvnrnd generates two different set of vectors with mean=[0 0] variance=[0.001 0;0 0.001] and seed[ 0 0];
whereas in simulink random number generator block generates two random number vectors which are repeatable with same seed.How to generate multivariate random number normally distributed in simulink?
The mvnrnd generates two different set of vectors with mean=[0 0] variance=[0.001 0;0 0.001] and seed[ 0 0];
whereas in simulink random number generator block generates two random number vectors which are repeatable with same seed. How to generate multivariate random number normally distributed in simulink?
The mvnrnd generates two different set of vectors with mean=[0 0] variance=[0.001 0;0 0.001] and seed[ 0 0];
whereas in simulink random number generator block generates two random number vectors which are repeatable with same seed. random numbers MATLAB Answers — New Questions
how can i create (generate) the Loop to Access Subfields:
Dears,
I need your help. hocan I access the subfields within eps_G, where eps_G is a structure.
whos myirfs1
Name Size Bytes Class Attributes
myirfs1 1×1 374094 struct
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% choose 1 or 2 below
shock_type = {‘eps_G’,’eps_nu’};
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux2 = {‘log_y_eps_nu’,’C_eps_nu’,’pi_ann_eps_nu’,’B_nominal_eps_nu’,’B_eps_nu’,’sp_eps_nu’,’i_ann_eps_nu’,’r_real_ann_eps_nu’,’P_eps_nu’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
%Irfs of monetary and fiscal policy
irf_mon = struct();
irf_fisc = struct();
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% when i run the following code it is unrecognized. can you suggest me what to do?
for i = 1:numel(var_aux)
irf_mon.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
irf_fisc.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
end
Unrecognized field name "log_y_eps_G".Dears,
I need your help. hocan I access the subfields within eps_G, where eps_G is a structure.
whos myirfs1
Name Size Bytes Class Attributes
myirfs1 1×1 374094 struct
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% choose 1 or 2 below
shock_type = {‘eps_G’,’eps_nu’};
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux2 = {‘log_y_eps_nu’,’C_eps_nu’,’pi_ann_eps_nu’,’B_nominal_eps_nu’,’B_eps_nu’,’sp_eps_nu’,’i_ann_eps_nu’,’r_real_ann_eps_nu’,’P_eps_nu’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
%Irfs of monetary and fiscal policy
irf_mon = struct();
irf_fisc = struct();
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% when i run the following code it is unrecognized. can you suggest me what to do?
for i = 1:numel(var_aux)
irf_mon.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
irf_fisc.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
end
Unrecognized field name "log_y_eps_G". Dears,
I need your help. hocan I access the subfields within eps_G, where eps_G is a structure.
whos myirfs1
Name Size Bytes Class Attributes
myirfs1 1×1 374094 struct
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% choose 1 or 2 below
shock_type = {‘eps_G’,’eps_nu’};
var_aux = {‘log_y’,’C’,’pi_ann’,’B_nominal’,’B’,’sp’,’i_ann’,’r_real_ann’,’P’};
var_aux2 = {‘log_y_eps_nu’,’C_eps_nu’,’pi_ann_eps_nu’,’B_nominal_eps_nu’,’B_eps_nu’,’sp_eps_nu’,’i_ann_eps_nu’,’r_real_ann_eps_nu’,’P_eps_nu’};
var_aux3 = {‘eps_G_log_y’,’eps_G_C’,’eps_G_pi_ann’,’eps_G_B_nominal’,’eps_G_B’,’eps_G_sp’,’eps_G_i_ann’,’eps_G_r_real_ann’,’eps_G_P’};
%Irfs of monetary and fiscal policy
irf_mon = struct();
irf_fisc = struct();
%% disp(fieldnames(myirfs1))
>> disp(fieldnames(myirfs1))
{‘eps_CP’}
{‘eps_G’ }
{‘eps_T’ }
{‘eps_a’ }
{‘eps_nu’}
{‘eps_z’ }
% when i run the following code it is unrecognized. can you suggest me what to do?
for i = 1:numel(var_aux)
irf_mon.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
irf_fisc.(var_aux{i}) = [0,myirfs1(1).(var_aux3{i})]’;
end
Unrecognized field name "log_y_eps_G". matlab coding ms dsge modelin MATLAB Answers — New Questions