Category: Matlab
Category Archives: Matlab
How to read a ‘CompactSVMModel’ saved in a .mat file from a C++/Qt program
I tried to save a machine learning model into a .mat file, and then read it from a Qt/C++ application. Following the documentation, I managed to read files containing basic types like double or int. As my model is of type ‘classreg.learning.classif.CompactClassificationSVM’, I wonder if it is still possible to read it.
As and example, i saved this iosnosphere model on matlab
load ionosphere
SVMModel = fitcsvm(X,Y,’Standardize’,true,’ClassNames’,{‘b’,’g’})
CompactSVMModel = compact(SVMModel)
save("CompactSVMModel.mat", "CompactSVMModel")
I imported the relevant library in the CMakeLists.txt
find_package(Matlab "x.xx" EXACT COMPONENTS "MX_LIBRARY" "MAT_LIBRARY" "DATAARRAY_LIBRARY" )
target_link_libraries(target PRIVATE Matlab::mat )
I used the "mat.h" library to open and read the data.
#include "mat.h"
int main () {
std::string stdFilename = "/filepath/CompactSVMModel.mat";
const char *variableName = "CompactSVMModel";
// Open the MAT-File
MATFile *matFile = matOpen(stdFilename.c_str(), "r");
if (!matFile) {
qDebug() << "Error opening MAT file: " << stdFilename;
}
// Read the variable from the MAT-File
mxArray *dataArray = matGetVariable(matFile, variableName);
if (!dataArray) {
qDebug() << "Error reading variable: " << variableName << " from MAT file: " << stdFilename;
}
…
// read a save the diffrent fields into containers
return 0;
}
At the first if statement, matFile is NULL.I tried to save a machine learning model into a .mat file, and then read it from a Qt/C++ application. Following the documentation, I managed to read files containing basic types like double or int. As my model is of type ‘classreg.learning.classif.CompactClassificationSVM’, I wonder if it is still possible to read it.
As and example, i saved this iosnosphere model on matlab
load ionosphere
SVMModel = fitcsvm(X,Y,’Standardize’,true,’ClassNames’,{‘b’,’g’})
CompactSVMModel = compact(SVMModel)
save("CompactSVMModel.mat", "CompactSVMModel")
I imported the relevant library in the CMakeLists.txt
find_package(Matlab "x.xx" EXACT COMPONENTS "MX_LIBRARY" "MAT_LIBRARY" "DATAARRAY_LIBRARY" )
target_link_libraries(target PRIVATE Matlab::mat )
I used the "mat.h" library to open and read the data.
#include "mat.h"
int main () {
std::string stdFilename = "/filepath/CompactSVMModel.mat";
const char *variableName = "CompactSVMModel";
// Open the MAT-File
MATFile *matFile = matOpen(stdFilename.c_str(), "r");
if (!matFile) {
qDebug() << "Error opening MAT file: " << stdFilename;
}
// Read the variable from the MAT-File
mxArray *dataArray = matGetVariable(matFile, variableName);
if (!dataArray) {
qDebug() << "Error reading variable: " << variableName << " from MAT file: " << stdFilename;
}
…
// read a save the diffrent fields into containers
return 0;
}
At the first if statement, matFile is NULL. I tried to save a machine learning model into a .mat file, and then read it from a Qt/C++ application. Following the documentation, I managed to read files containing basic types like double or int. As my model is of type ‘classreg.learning.classif.CompactClassificationSVM’, I wonder if it is still possible to read it.
As and example, i saved this iosnosphere model on matlab
load ionosphere
SVMModel = fitcsvm(X,Y,’Standardize’,true,’ClassNames’,{‘b’,’g’})
CompactSVMModel = compact(SVMModel)
save("CompactSVMModel.mat", "CompactSVMModel")
I imported the relevant library in the CMakeLists.txt
find_package(Matlab "x.xx" EXACT COMPONENTS "MX_LIBRARY" "MAT_LIBRARY" "DATAARRAY_LIBRARY" )
target_link_libraries(target PRIVATE Matlab::mat )
I used the "mat.h" library to open and read the data.
#include "mat.h"
int main () {
std::string stdFilename = "/filepath/CompactSVMModel.mat";
const char *variableName = "CompactSVMModel";
// Open the MAT-File
MATFile *matFile = matOpen(stdFilename.c_str(), "r");
if (!matFile) {
qDebug() << "Error opening MAT file: " << stdFilename;
}
// Read the variable from the MAT-File
mxArray *dataArray = matGetVariable(matFile, variableName);
if (!dataArray) {
qDebug() << "Error reading variable: " << variableName << " from MAT file: " << stdFilename;
}
…
// read a save the diffrent fields into containers
return 0;
}
At the first if statement, matFile is NULL. matlab, c++, machine learning, matrix MATLAB Answers — New Questions
I am trying to derive an equation for (RLC model) and i am stuck at one point how he get the final equation (12) second part?
Capacitor discharging in RLC series circuit. Equation (8) general solution for the discharging current,
i(t)=e^(-αt) (A cos(ωt)+B sin(ωt)) (8)
Now we will find the constant A and B using the initial condition assuming the capacitor voltage VDC and current IDC. The initial conditions are taken just before the fault occurs.
At t=0
i(0)=I_DC=A
Then the nominal voltage at the initial condition is equal to to the nominal voltage.
Vc(0)=V_DC
To find B take the derivative of the equation (8) we get
(di(t))/dt=e^(-αt) (-α(A cos(ωt)+B sin(ωt) )+ω(B cos(ωt)-A sin(ωt)) (9)
At t=0
(di(0))/dt=-αA+ωB
The initial rate of change of current is equal to
(di(0))/dt=(V_L (0))/L=-αA+ωB
Using
A=I_DC
B=((V_L (0))/L+αI_DC)/ω
Since the RLC is a series circuit and initial conditions are the same thus the current is also the same across R, L, and C.
(V_L (0))/L=I_L=I_DC
B=(I_DC+αA)/ω (10)
Putting the values of A and B in the equation (8) we get
i(t)=e^(-αt) (I_DC cos(ωt)+(I_DC+αA)/ω sin(ωt)) (11)
For the capacitor
1/C i(0)=V_c (0) and for initial condition i(0)=I_DC so 1/C I_DC=V_DC
“A” becomes equal to
A=I_DC=CV_DC
Expressing the equation in terms of the A and B from equation (10)
I_DC=Bω-Aα
So putting in equation (10)
i(t)=[(Bω-αA) cos(ωt)-(Aω+Bα) sin(ωt)]e^(-αt) (12)Capacitor discharging in RLC series circuit. Equation (8) general solution for the discharging current,
i(t)=e^(-αt) (A cos(ωt)+B sin(ωt)) (8)
Now we will find the constant A and B using the initial condition assuming the capacitor voltage VDC and current IDC. The initial conditions are taken just before the fault occurs.
At t=0
i(0)=I_DC=A
Then the nominal voltage at the initial condition is equal to to the nominal voltage.
Vc(0)=V_DC
To find B take the derivative of the equation (8) we get
(di(t))/dt=e^(-αt) (-α(A cos(ωt)+B sin(ωt) )+ω(B cos(ωt)-A sin(ωt)) (9)
At t=0
(di(0))/dt=-αA+ωB
The initial rate of change of current is equal to
(di(0))/dt=(V_L (0))/L=-αA+ωB
Using
A=I_DC
B=((V_L (0))/L+αI_DC)/ω
Since the RLC is a series circuit and initial conditions are the same thus the current is also the same across R, L, and C.
(V_L (0))/L=I_L=I_DC
B=(I_DC+αA)/ω (10)
Putting the values of A and B in the equation (8) we get
i(t)=e^(-αt) (I_DC cos(ωt)+(I_DC+αA)/ω sin(ωt)) (11)
For the capacitor
1/C i(0)=V_c (0) and for initial condition i(0)=I_DC so 1/C I_DC=V_DC
“A” becomes equal to
A=I_DC=CV_DC
Expressing the equation in terms of the A and B from equation (10)
I_DC=Bω-Aα
So putting in equation (10)
i(t)=[(Bω-αA) cos(ωt)-(Aω+Bα) sin(ωt)]e^(-αt) (12) Capacitor discharging in RLC series circuit. Equation (8) general solution for the discharging current,
i(t)=e^(-αt) (A cos(ωt)+B sin(ωt)) (8)
Now we will find the constant A and B using the initial condition assuming the capacitor voltage VDC and current IDC. The initial conditions are taken just before the fault occurs.
At t=0
i(0)=I_DC=A
Then the nominal voltage at the initial condition is equal to to the nominal voltage.
Vc(0)=V_DC
To find B take the derivative of the equation (8) we get
(di(t))/dt=e^(-αt) (-α(A cos(ωt)+B sin(ωt) )+ω(B cos(ωt)-A sin(ωt)) (9)
At t=0
(di(0))/dt=-αA+ωB
The initial rate of change of current is equal to
(di(0))/dt=(V_L (0))/L=-αA+ωB
Using
A=I_DC
B=((V_L (0))/L+αI_DC)/ω
Since the RLC is a series circuit and initial conditions are the same thus the current is also the same across R, L, and C.
(V_L (0))/L=I_L=I_DC
B=(I_DC+αA)/ω (10)
Putting the values of A and B in the equation (8) we get
i(t)=e^(-αt) (I_DC cos(ωt)+(I_DC+αA)/ω sin(ωt)) (11)
For the capacitor
1/C i(0)=V_c (0) and for initial condition i(0)=I_DC so 1/C I_DC=V_DC
“A” becomes equal to
A=I_DC=CV_DC
Expressing the equation in terms of the A and B from equation (10)
I_DC=Bω-Aα
So putting in equation (10)
i(t)=[(Bω-αA) cos(ωt)-(Aω+Bα) sin(ωt)]e^(-αt) (12) matrix, mathematics, electrical, circuit design MATLAB Answers — New Questions
Returning workspace outputs is supported with only single return argument
Dear,
I am trying to run a simulink model in m-code while optimizing ADRC parameters with PSO, but I get an error:
‘Returning workspace outputs is supported with only single return argument’.
The first figure is ‘PSO_ADRC’ code and the second figure is the simulink model ‘ADRC_test’.
Hope someone can help me, thanks.Dear,
I am trying to run a simulink model in m-code while optimizing ADRC parameters with PSO, but I get an error:
‘Returning workspace outputs is supported with only single return argument’.
The first figure is ‘PSO_ADRC’ code and the second figure is the simulink model ‘ADRC_test’.
Hope someone can help me, thanks. Dear,
I am trying to run a simulink model in m-code while optimizing ADRC parameters with PSO, but I get an error:
‘Returning workspace outputs is supported with only single return argument’.
The first figure is ‘PSO_ADRC’ code and the second figure is the simulink model ‘ADRC_test’.
Hope someone can help me, thanks. simulink, matlab MATLAB Answers — New Questions
zipping empty subdirectories
I try to zip a directory which contains empty sub-directories but zip() function ignore the empty ones. Is there way to include the empty subdirectories as well?I try to zip a directory which contains empty sub-directories but zip() function ignore the empty ones. Is there way to include the empty subdirectories as well? I try to zip a directory which contains empty sub-directories but zip() function ignore the empty ones. Is there way to include the empty subdirectories as well? zip MATLAB Answers — New Questions
Solve integral in nested function
hello there,
i am trying to build something like this:
if true
function x = first
x = 5*y
function y = nested
I = @(x) x^2
y = integral(I,0,1)
end
end
end
but there occurs an error stating: ‘Error: Function definitions are not permitted in this context.’
Does anyone know an alternative or sees the misstake i made?
thanks!hello there,
i am trying to build something like this:
if true
function x = first
x = 5*y
function y = nested
I = @(x) x^2
y = integral(I,0,1)
end
end
end
but there occurs an error stating: ‘Error: Function definitions are not permitted in this context.’
Does anyone know an alternative or sees the misstake i made?
thanks! hello there,
i am trying to build something like this:
if true
function x = first
x = 5*y
function y = nested
I = @(x) x^2
y = integral(I,0,1)
end
end
end
but there occurs an error stating: ‘Error: Function definitions are not permitted in this context.’
Does anyone know an alternative or sees the misstake i made?
thanks! integral, nested functions, passing results MATLAB Answers — New Questions
SIMULINK: Set a random seed in the Block Parameters: Random Number GUI
SIMULINK
How do I set a random seed in the user GUI for a random number block? (So I get a random number at each sim run)
ThanksSIMULINK
How do I set a random seed in the user GUI for a random number block? (So I get a random number at each sim run)
Thanks SIMULINK
How do I set a random seed in the user GUI for a random number block? (So I get a random number at each sim run)
Thanks simulink, random number generator MATLAB Answers — New Questions
How do I merge vectors?
I have a 10X1 vector A=[1;3;7;10;12;14;15;18;20;21] and a 10X1 vector B=[3;12;15;18;20;0;0;0;0;0]. Is there a way to come up with a 10X2 vector C such that the equal elements in each vector sit at the same row in vector C? I want to retain all elements of vector A in vector C and keep only the elements from vector B that have values equal to the one elements in vector A. Ideally, My final vector C would look something like this:
C=[1 0;3 3;7 0;10 0;12 12;14 0;15 15;18 18;20 20;21 0]. Any thoughts?I have a 10X1 vector A=[1;3;7;10;12;14;15;18;20;21] and a 10X1 vector B=[3;12;15;18;20;0;0;0;0;0]. Is there a way to come up with a 10X2 vector C such that the equal elements in each vector sit at the same row in vector C? I want to retain all elements of vector A in vector C and keep only the elements from vector B that have values equal to the one elements in vector A. Ideally, My final vector C would look something like this:
C=[1 0;3 3;7 0;10 0;12 12;14 0;15 15;18 18;20 20;21 0]. Any thoughts? I have a 10X1 vector A=[1;3;7;10;12;14;15;18;20;21] and a 10X1 vector B=[3;12;15;18;20;0;0;0;0;0]. Is there a way to come up with a 10X2 vector C such that the equal elements in each vector sit at the same row in vector C? I want to retain all elements of vector A in vector C and keep only the elements from vector B that have values equal to the one elements in vector A. Ideally, My final vector C would look something like this:
C=[1 0;3 3;7 0;10 0;12 12;14 0;15 15;18 18;20 20;21 0]. Any thoughts? merging vectors MATLAB Answers — New Questions
Can you explain the difference between the two matrix operations in MATLAB?
I am trying to understand how MATLAB performs the following matrix operations:
Example 1:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -1 * (Vector1(m))+ Matrix2;
end
Example 2:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
Igl = speye(Ny+1);
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -Igl * (Vector1(m))+ Matrix2;
end
Why is Matrix1 different in Example1 and Example 2? In particular, in Example 1 how is the scalar multiplication of the row vector (Vector1(m)) added to Matrix 2? I am trying to understand the matrix operation done in Example 1 specifically so I can transfer it to C/C++. ThanksI am trying to understand how MATLAB performs the following matrix operations:
Example 1:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -1 * (Vector1(m))+ Matrix2;
end
Example 2:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
Igl = speye(Ny+1);
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -Igl * (Vector1(m))+ Matrix2;
end
Why is Matrix1 different in Example1 and Example 2? In particular, in Example 1 how is the scalar multiplication of the row vector (Vector1(m)) added to Matrix 2? I am trying to understand the matrix operation done in Example 1 specifically so I can transfer it to C/C++. Thanks I am trying to understand how MATLAB performs the following matrix operations:
Example 1:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -1 * (Vector1(m))+ Matrix2;
end
Example 2:
clearvars; clc; close all;
Nx = 8;
Ny = 8;
Lx=2*pi;
dx = Lx/Nx;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
Igl = speye(Ny+1);
[Matrix2,x] = cheb(Ny);
for m = 1:length(Vec)
Matrix1 = -Igl * (Vector1(m))+ Matrix2;
end
Why is Matrix1 different in Example1 and Example 2? In particular, in Example 1 how is the scalar multiplication of the row vector (Vector1(m)) added to Matrix 2? I am trying to understand the matrix operation done in Example 1 specifically so I can transfer it to C/C++. Thanks matrix MATLAB Answers — New Questions
how to find connected component in an image
i’m doing a project to recognize kannada text,the first step says find connected components from a binarynimage.i tried doing it using bwconncomp but i’m not able to display the image.soo can u please help me with dis.i’m doing a project to recognize kannada text,the first step says find connected components from a binarynimage.i tried doing it using bwconncomp but i’m not able to display the image.soo can u please help me with dis. i’m doing a project to recognize kannada text,the first step says find connected components from a binarynimage.i tried doing it using bwconncomp but i’m not able to display the image.soo can u please help me with dis. ocr, kannada, image segmentation, connected components MATLAB Answers — New Questions
I am running external mode on arduino mega and the analog inputs are always high. What is wrong in my settings?
I am trying to run external mode and read an Analog Input on an Arduino Mega. I always see the input set to high (5) no mater what my actual voltage is. I just convert the analog input to read between 0-5V (5/1023), but there is no other response. It’s always stuch in high. All Analog outputs are working properly, but I cannot fix my input readings. Is there a setting that I have to change? What am I doing wrong? TIAI am trying to run external mode and read an Analog Input on an Arduino Mega. I always see the input set to high (5) no mater what my actual voltage is. I just convert the analog input to read between 0-5V (5/1023), but there is no other response. It’s always stuch in high. All Analog outputs are working properly, but I cannot fix my input readings. Is there a setting that I have to change? What am I doing wrong? TIA I am trying to run external mode and read an Analog Input on an Arduino Mega. I always see the input set to high (5) no mater what my actual voltage is. I just convert the analog input to read between 0-5V (5/1023), but there is no other response. It’s always stuch in high. All Analog outputs are working properly, but I cannot fix my input readings. Is there a setting that I have to change? What am I doing wrong? TIA arduino mega, analog inputs, external mode MATLAB Answers — New Questions
LTE Turbo encoder with R = 1/2 – BER performance with LTE Toolbox
Hi there,
I am trying to make BER performance of LTE Turbo encoding with rate matching R = 1/2. But, when I implement symbol modulation and demodulation I can’t get BER = 0 (without any AWGN existence). This indicates that problem is in mod/demod part. I will be also great to use BPSK instead of QPSK but lteSymbolModulate doesn’t have this modulation scheme. Thank You in advance.
All best,
Mirza
Code: (credits to answer how-to-use-rate-matching-to-alter-turbo-code-rate)
clear;
K = 128;
E = 2*K;
mbits = randi([0,1],K, 1);
crc = lteCRCEncode(mbits,’24A’);
cbs = lteCodeBlockSegment(crc); % This will provide a length 4096 bits that is input to the Turbo encoder
cd = lteTurboEncode(cbs);
cdrm = lteRateMatchTurbo(cd, E, 0);
%cdrm(cdrm == 0) = -1; % Make them as LLRs
txSymbols = lteSymbolModulate(cdrm,’QPSK’);
awgnchan = comm.AWGNChannel(‘NoiseMethod’,’Variance’,’Variance’,3);
rxSymbols = txSymbols;% awgnchan(txSymbols);
softBits= lteSymbolDemodulate(rxSymbols,’QPSK’,’Soft’);
cdrx = lteRateRecoverTurbo(softBits, K, 0);
%
mhat = lteTurboDecode(cdrx); % So after the Turbo decoding, it will have 4096 bits rather than 4032 bits, due to addition of filler bits and CRC
cbshat = lteCodeBlockDesegment(mhat, K+24);
crchat = lteCRCDecode(cbshat,’24A’); % This will return the same as message length
% Check the decoded bits with message bits
[~,BER] = biterr( double(crchat),mbits);
BERHi there,
I am trying to make BER performance of LTE Turbo encoding with rate matching R = 1/2. But, when I implement symbol modulation and demodulation I can’t get BER = 0 (without any AWGN existence). This indicates that problem is in mod/demod part. I will be also great to use BPSK instead of QPSK but lteSymbolModulate doesn’t have this modulation scheme. Thank You in advance.
All best,
Mirza
Code: (credits to answer how-to-use-rate-matching-to-alter-turbo-code-rate)
clear;
K = 128;
E = 2*K;
mbits = randi([0,1],K, 1);
crc = lteCRCEncode(mbits,’24A’);
cbs = lteCodeBlockSegment(crc); % This will provide a length 4096 bits that is input to the Turbo encoder
cd = lteTurboEncode(cbs);
cdrm = lteRateMatchTurbo(cd, E, 0);
%cdrm(cdrm == 0) = -1; % Make them as LLRs
txSymbols = lteSymbolModulate(cdrm,’QPSK’);
awgnchan = comm.AWGNChannel(‘NoiseMethod’,’Variance’,’Variance’,3);
rxSymbols = txSymbols;% awgnchan(txSymbols);
softBits= lteSymbolDemodulate(rxSymbols,’QPSK’,’Soft’);
cdrx = lteRateRecoverTurbo(softBits, K, 0);
%
mhat = lteTurboDecode(cdrx); % So after the Turbo decoding, it will have 4096 bits rather than 4032 bits, due to addition of filler bits and CRC
cbshat = lteCodeBlockDesegment(mhat, K+24);
crchat = lteCRCDecode(cbshat,’24A’); % This will return the same as message length
% Check the decoded bits with message bits
[~,BER] = biterr( double(crchat),mbits);
BER Hi there,
I am trying to make BER performance of LTE Turbo encoding with rate matching R = 1/2. But, when I implement symbol modulation and demodulation I can’t get BER = 0 (without any AWGN existence). This indicates that problem is in mod/demod part. I will be also great to use BPSK instead of QPSK but lteSymbolModulate doesn’t have this modulation scheme. Thank You in advance.
All best,
Mirza
Code: (credits to answer how-to-use-rate-matching-to-alter-turbo-code-rate)
clear;
K = 128;
E = 2*K;
mbits = randi([0,1],K, 1);
crc = lteCRCEncode(mbits,’24A’);
cbs = lteCodeBlockSegment(crc); % This will provide a length 4096 bits that is input to the Turbo encoder
cd = lteTurboEncode(cbs);
cdrm = lteRateMatchTurbo(cd, E, 0);
%cdrm(cdrm == 0) = -1; % Make them as LLRs
txSymbols = lteSymbolModulate(cdrm,’QPSK’);
awgnchan = comm.AWGNChannel(‘NoiseMethod’,’Variance’,’Variance’,3);
rxSymbols = txSymbols;% awgnchan(txSymbols);
softBits= lteSymbolDemodulate(rxSymbols,’QPSK’,’Soft’);
cdrx = lteRateRecoverTurbo(softBits, K, 0);
%
mhat = lteTurboDecode(cdrx); % So after the Turbo decoding, it will have 4096 bits rather than 4032 bits, due to addition of filler bits and CRC
cbshat = lteCodeBlockDesegment(mhat, K+24);
crchat = lteCRCDecode(cbshat,’24A’); % This will return the same as message length
% Check the decoded bits with message bits
[~,BER] = biterr( double(crchat),mbits);
BER lte toolbox, lte rate match turbo MATLAB Answers — New Questions
For loop on .txt serie
I have a time serie mySerie.txt (1000×1).
I need to evaluate a function on consecutive subseries with increase in length, from 350 points up to 750 points.
Example: starting from latest 350 points (from 651 : 1000, first serie) I have to apply myFunction and get a result,then do the same but this time on data from 650:1000, and again from 649 : 1000 and so on up to the last iteration on 251:1000.These are 750 iterations and I will get 750 result from myFunction, saved in an array or vector in order to be plotted.Thanks for any help.I have a time serie mySerie.txt (1000×1).
I need to evaluate a function on consecutive subseries with increase in length, from 350 points up to 750 points.
Example: starting from latest 350 points (from 651 : 1000, first serie) I have to apply myFunction and get a result,then do the same but this time on data from 650:1000, and again from 649 : 1000 and so on up to the last iteration on 251:1000.These are 750 iterations and I will get 750 result from myFunction, saved in an array or vector in order to be plotted.Thanks for any help. I have a time serie mySerie.txt (1000×1).
I need to evaluate a function on consecutive subseries with increase in length, from 350 points up to 750 points.
Example: starting from latest 350 points (from 651 : 1000, first serie) I have to apply myFunction and get a result,then do the same but this time on data from 650:1000, and again from 649 : 1000 and so on up to the last iteration on 251:1000.These are 750 iterations and I will get 750 result from myFunction, saved in an array or vector in order to be plotted.Thanks for any help. for loop MATLAB Answers — New Questions
model settings- dialog box is not opening
i want to change certain settings in model – matlab- stateflow,
but i am facing errors
error:- issue while creating model configuration parameters dialog box, i have attached snipi want to change certain settings in model – matlab- stateflow,
but i am facing errors
error:- issue while creating model configuration parameters dialog box, i have attached snip i want to change certain settings in model – matlab- stateflow,
but i am facing errors
error:- issue while creating model configuration parameters dialog box, i have attached snip stateflow, matlab2022b MATLAB Answers — New Questions
how to merge tables without any common keywords?
I have a 20*20,a 20*1 and a 1*20 tables. I would like add the last two tables into the first one and become a 21*21 table. However all of the three tables are exactly numeric and do not have name for rows and columns and no common keywords.I have a 20*20,a 20*1 and a 1*20 tables. I would like add the last two tables into the first one and become a 21*21 table. However all of the three tables are exactly numeric and do not have name for rows and columns and no common keywords. I have a 20*20,a 20*1 and a 1*20 tables. I would like add the last two tables into the first one and become a 21*21 table. However all of the three tables are exactly numeric and do not have name for rows and columns and no common keywords. merge tables, add row in table, add column in table MATLAB Answers — New Questions
How to create configurable number of inputs/outputs channel.
We are working creating generic model which will have upto 10 input/output bus channels. But based on project we may need anything between 1 to 10 channels. How can we make configurable model which can select the inputs/outputs required.We are working creating generic model which will have upto 10 input/output bus channels. But based on project we may need anything between 1 to 10 channels. How can we make configurable model which can select the inputs/outputs required. We are working creating generic model which will have upto 10 input/output bus channels. But based on project we may need anything between 1 to 10 channels. How can we make configurable model which can select the inputs/outputs required. simulink, variant subsystem MATLAB Answers — New Questions
I get the illegal instruction error while running Matlab code with GPU
I get the illegal instruction error while running Matlab code with GPU.
when using matlab train networks and calculate big matrix with GPU, this error will happen.I get the illegal instruction error while running Matlab code with GPU.
when using matlab train networks and calculate big matrix with GPU, this error will happen. I get the illegal instruction error while running Matlab code with GPU.
when using matlab train networks and calculate big matrix with GPU, this error will happen. gpu MATLAB Answers — New Questions
Compiled App running extremely slow in the MATLAB runtime environment
Hello
I composed a code on Ubuntu Desktop 22.04LTS using Matlab R2024a, and it takes 236 seconds to execute.
Then i compiled it into a linux app and install Matlab runtime 2024a on the same computer (bare metal, not virtual machine, i7-6790K, 16GB RAM),
but the app executed extremely slow with the Matlab runtime, after serveral loops, its outputs seens stopped, but the thread is still running.
I didn’t using Parallel Computing Toolbox in my code.Hello
I composed a code on Ubuntu Desktop 22.04LTS using Matlab R2024a, and it takes 236 seconds to execute.
Then i compiled it into a linux app and install Matlab runtime 2024a on the same computer (bare metal, not virtual machine, i7-6790K, 16GB RAM),
but the app executed extremely slow with the Matlab runtime, after serveral loops, its outputs seens stopped, but the thread is still running.
I didn’t using Parallel Computing Toolbox in my code. Hello
I composed a code on Ubuntu Desktop 22.04LTS using Matlab R2024a, and it takes 236 seconds to execute.
Then i compiled it into a linux app and install Matlab runtime 2024a on the same computer (bare metal, not virtual machine, i7-6790K, 16GB RAM),
but the app executed extremely slow with the Matlab runtime, after serveral loops, its outputs seens stopped, but the thread is still running.
I didn’t using Parallel Computing Toolbox in my code. matlab runtime, matlab, matlab compiler MATLAB Answers — New Questions
How to fix it standalone application problem error during packaging in matlab R2014a please any have correct solution for such error
When I type command in command prompt is Error using mcc
Test checkout of feature ‘Compiler’ failed and when I convert .m file to standalone application it’s showing error and open and file log with showing error this oneWhen I type command in command prompt is Error using mcc
Test checkout of feature ‘Compiler’ failed and when I convert .m file to standalone application it’s showing error and open and file log with showing error this one When I type command in command prompt is Error using mcc
Test checkout of feature ‘Compiler’ failed and when I convert .m file to standalone application it’s showing error and open and file log with showing error this one please give me correct solution MATLAB Answers — New Questions
how to write file in PS using simulink
We are using a ZCU111 board and matlab/simulink to implement RFSoC logics. We are developing using the example on the Matlab website ( https://www.mathworks.com/help/soc/ug/ReceiveSignalWaveformUsingDDR4onXilinxRFSoCDevice.html ). There are PL and PS/processor in RFSoC. We want to create/generate data in PL and save data in PS.
Currently, a file has been created in PS. It is not the data we want, but it is writing something. However, after rebooting, it can no longer write data. Also, it is currently writing data to only one file, but we want to manage data events for multiple files. We are saving data in a set of FIFOs and are able to read it out to the computer, but we want to save this data as incrementally named files (event1, event2, etc.) on the PS system instead.
In other words, there are two questions.
Q1. How can we generate files per event in PS/processor?
Q2. How do we keep writing data to files even after a reboot in PS/processor?We are using a ZCU111 board and matlab/simulink to implement RFSoC logics. We are developing using the example on the Matlab website ( https://www.mathworks.com/help/soc/ug/ReceiveSignalWaveformUsingDDR4onXilinxRFSoCDevice.html ). There are PL and PS/processor in RFSoC. We want to create/generate data in PL and save data in PS.
Currently, a file has been created in PS. It is not the data we want, but it is writing something. However, after rebooting, it can no longer write data. Also, it is currently writing data to only one file, but we want to manage data events for multiple files. We are saving data in a set of FIFOs and are able to read it out to the computer, but we want to save this data as incrementally named files (event1, event2, etc.) on the PS system instead.
In other words, there are two questions.
Q1. How can we generate files per event in PS/processor?
Q2. How do we keep writing data to files even after a reboot in PS/processor? We are using a ZCU111 board and matlab/simulink to implement RFSoC logics. We are developing using the example on the Matlab website ( https://www.mathworks.com/help/soc/ug/ReceiveSignalWaveformUsingDDR4onXilinxRFSoCDevice.html ). There are PL and PS/processor in RFSoC. We want to create/generate data in PL and save data in PS.
Currently, a file has been created in PS. It is not the data we want, but it is writing something. However, after rebooting, it can no longer write data. Also, it is currently writing data to only one file, but we want to manage data events for multiple files. We are saving data in a set of FIFOs and are able to read it out to the computer, but we want to save this data as incrementally named files (event1, event2, etc.) on the PS system instead.
In other words, there are two questions.
Q1. How can we generate files per event in PS/processor?
Q2. How do we keep writing data to files even after a reboot in PS/processor? write file in ps/processor MATLAB Answers — New Questions
How to evaluate if my design/matlab code/algorithm can be dumped in controller or processor or fpga or gpu?
I would like to know how can I see what can i use for my application for example:
i am trying to do take image and do the segmentation using blob analysis to identify a object in an image or video. how to determine whether i would need a controller or microprocessor or fpga or gpu ?I would like to know how can I see what can i use for my application for example:
i am trying to do take image and do the segmentation using blob analysis to identify a object in an image or video. how to determine whether i would need a controller or microprocessor or fpga or gpu ? I would like to know how can I see what can i use for my application for example:
i am trying to do take image and do the segmentation using blob analysis to identify a object in an image or video. how to determine whether i would need a controller or microprocessor or fpga or gpu ? fpga, gpu, controller, processor MATLAB Answers — New Questions