Author: PuTI
Infineon Buck Simscape Example – View_system(‘BuckSystem’) unrecognized function or variable ‘view system” error
I’ve tried running the "Infineon Buck Simscape Example" both online and locally and get the following error
View_system(‘BuckSystem’) unrecognized function or variable ‘view system"
I’m running R2023bI’ve tried running the "Infineon Buck Simscape Example" both online and locally and get the following error
View_system(‘BuckSystem’) unrecognized function or variable ‘view system"
I’m running R2023b I’ve tried running the "Infineon Buck Simscape Example" both online and locally and get the following error
View_system(‘BuckSystem’) unrecognized function or variable ‘view system"
I’m running R2023b infineon buck, view_system MATLAB Answers — New Questions
I am trying to control a DC to DC boost converter using FSC MPC to generate a 20 kW PV power but the MPC controller is very poorly than PI controller.
I am trying to control a DC to DC boost converter using FSC MPC to generate a 20 kW PV power but the MPC controller generated a maximum of 1135 W PV power and a maximum of 7184 W DC load power instead of 20 kW power. The PV voltage has a maximum of 59 V against 847 V boosted voltage with 21 A maximum PV current against a maximum of 27 A inductor current. Below is the MPC script used in the Matlab function block:
function S = MPC_Boost(iL, V_PV, Vout, iL_ref, wf_min, wf_max, Dref)
% MPC controller for boost converter with iL_ref from MPPT logic
%% System Parameters
Ts = 10e-6;
RL = 0.02;
L = 0.0199;
C = 3.1222e-04;
R_load = 18;
%% Limits
iL_max = 20;
iL_min = 0.2;
Vout_max = 420;
Vout_min = 360;
P_PV_max = 20000;
Vout_ref = 400;
%% Persistent memory
persistent S_old wf;
if isempty(S_old)
S_old = Dref;
wf = wf_min;
end
%% Sanitize Inputs
iL = abs(iL);
Vout = abs(Vout);
V_PV = max(V_PV, 50);
%% Duty Cycle Candidates
states = [Dref – 0.05; Dref; Dref + 0.05];
states = min(max(states, 0.3), 0.9); % Clamp
%% Cost Evaluation
g = zeros(length(states),1);
g_min = inf;
n_best = 1;
X_k = [iL; Vout];
for n = 1:length(states)
D = states(n);
% Discrete model
A_d = [1 – (RL * Ts / L), -(1 – D) * (Ts / L);
(1 – D) * (Ts / C), 1 – (Ts / (R_load * C))];
B_d = [Ts / L; 0];
% Predict state
X_k1 = A_d * X_k + B_d * V_PV;
iboost_k1 = X_k1(1);
Vout_k1 = X_k1(2);
P_PV_pred = V_PV * iboost_k1;
% Constraint check
if iboost_k1 < iL_min || iboost_k1 > iL_max || …
Vout_k1 < Vout_min || Vout_k1 > Vout_max || …
P_PV_pred <= 0 || P_PV_pred > P_PV_max || …
isnan(iboost_k1) || isnan(Vout_k1)
g(n) = inf;
continue;
end
% Cost terms
g_iboost = (iL_ref – iboost_k1)^2;
g_vout = (Vout_ref – Vout_k1)^2;
g_sw = (D ~= S_old) * wf;
g_dref = (D – Dref)^2;
g_pv = (P_PV_pred < 100) * 1000;
% Total cost
g(n) = g_iboost + 0.1 * g_vout + g_sw + g_dref + g_pv;
if g(n) < g_min
g_min = g(n);
n_best = n;
end
end
%% Apply Selected Duty Cycle
S = states(n_best);
S = min(max(S, 0.3), 0.9); % Clamp again
% Adaptive penalty update
if S ~= S_old
wf = min(wf * 1.10, wf_max);
else
wf = max(wf * 0.90, wf_min);
end
S_old = S;
endI am trying to control a DC to DC boost converter using FSC MPC to generate a 20 kW PV power but the MPC controller generated a maximum of 1135 W PV power and a maximum of 7184 W DC load power instead of 20 kW power. The PV voltage has a maximum of 59 V against 847 V boosted voltage with 21 A maximum PV current against a maximum of 27 A inductor current. Below is the MPC script used in the Matlab function block:
function S = MPC_Boost(iL, V_PV, Vout, iL_ref, wf_min, wf_max, Dref)
% MPC controller for boost converter with iL_ref from MPPT logic
%% System Parameters
Ts = 10e-6;
RL = 0.02;
L = 0.0199;
C = 3.1222e-04;
R_load = 18;
%% Limits
iL_max = 20;
iL_min = 0.2;
Vout_max = 420;
Vout_min = 360;
P_PV_max = 20000;
Vout_ref = 400;
%% Persistent memory
persistent S_old wf;
if isempty(S_old)
S_old = Dref;
wf = wf_min;
end
%% Sanitize Inputs
iL = abs(iL);
Vout = abs(Vout);
V_PV = max(V_PV, 50);
%% Duty Cycle Candidates
states = [Dref – 0.05; Dref; Dref + 0.05];
states = min(max(states, 0.3), 0.9); % Clamp
%% Cost Evaluation
g = zeros(length(states),1);
g_min = inf;
n_best = 1;
X_k = [iL; Vout];
for n = 1:length(states)
D = states(n);
% Discrete model
A_d = [1 – (RL * Ts / L), -(1 – D) * (Ts / L);
(1 – D) * (Ts / C), 1 – (Ts / (R_load * C))];
B_d = [Ts / L; 0];
% Predict state
X_k1 = A_d * X_k + B_d * V_PV;
iboost_k1 = X_k1(1);
Vout_k1 = X_k1(2);
P_PV_pred = V_PV * iboost_k1;
% Constraint check
if iboost_k1 < iL_min || iboost_k1 > iL_max || …
Vout_k1 < Vout_min || Vout_k1 > Vout_max || …
P_PV_pred <= 0 || P_PV_pred > P_PV_max || …
isnan(iboost_k1) || isnan(Vout_k1)
g(n) = inf;
continue;
end
% Cost terms
g_iboost = (iL_ref – iboost_k1)^2;
g_vout = (Vout_ref – Vout_k1)^2;
g_sw = (D ~= S_old) * wf;
g_dref = (D – Dref)^2;
g_pv = (P_PV_pred < 100) * 1000;
% Total cost
g(n) = g_iboost + 0.1 * g_vout + g_sw + g_dref + g_pv;
if g(n) < g_min
g_min = g(n);
n_best = n;
end
end
%% Apply Selected Duty Cycle
S = states(n_best);
S = min(max(S, 0.3), 0.9); % Clamp again
% Adaptive penalty update
if S ~= S_old
wf = min(wf * 1.10, wf_max);
else
wf = max(wf * 0.90, wf_min);
end
S_old = S;
end I am trying to control a DC to DC boost converter using FSC MPC to generate a 20 kW PV power but the MPC controller generated a maximum of 1135 W PV power and a maximum of 7184 W DC load power instead of 20 kW power. The PV voltage has a maximum of 59 V against 847 V boosted voltage with 21 A maximum PV current against a maximum of 27 A inductor current. Below is the MPC script used in the Matlab function block:
function S = MPC_Boost(iL, V_PV, Vout, iL_ref, wf_min, wf_max, Dref)
% MPC controller for boost converter with iL_ref from MPPT logic
%% System Parameters
Ts = 10e-6;
RL = 0.02;
L = 0.0199;
C = 3.1222e-04;
R_load = 18;
%% Limits
iL_max = 20;
iL_min = 0.2;
Vout_max = 420;
Vout_min = 360;
P_PV_max = 20000;
Vout_ref = 400;
%% Persistent memory
persistent S_old wf;
if isempty(S_old)
S_old = Dref;
wf = wf_min;
end
%% Sanitize Inputs
iL = abs(iL);
Vout = abs(Vout);
V_PV = max(V_PV, 50);
%% Duty Cycle Candidates
states = [Dref – 0.05; Dref; Dref + 0.05];
states = min(max(states, 0.3), 0.9); % Clamp
%% Cost Evaluation
g = zeros(length(states),1);
g_min = inf;
n_best = 1;
X_k = [iL; Vout];
for n = 1:length(states)
D = states(n);
% Discrete model
A_d = [1 – (RL * Ts / L), -(1 – D) * (Ts / L);
(1 – D) * (Ts / C), 1 – (Ts / (R_load * C))];
B_d = [Ts / L; 0];
% Predict state
X_k1 = A_d * X_k + B_d * V_PV;
iboost_k1 = X_k1(1);
Vout_k1 = X_k1(2);
P_PV_pred = V_PV * iboost_k1;
% Constraint check
if iboost_k1 < iL_min || iboost_k1 > iL_max || …
Vout_k1 < Vout_min || Vout_k1 > Vout_max || …
P_PV_pred <= 0 || P_PV_pred > P_PV_max || …
isnan(iboost_k1) || isnan(Vout_k1)
g(n) = inf;
continue;
end
% Cost terms
g_iboost = (iL_ref – iboost_k1)^2;
g_vout = (Vout_ref – Vout_k1)^2;
g_sw = (D ~= S_old) * wf;
g_dref = (D – Dref)^2;
g_pv = (P_PV_pred < 100) * 1000;
% Total cost
g(n) = g_iboost + 0.1 * g_vout + g_sw + g_dref + g_pv;
if g(n) < g_min
g_min = g(n);
n_best = n;
end
end
%% Apply Selected Duty Cycle
S = states(n_best);
S = min(max(S, 0.3), 0.9); % Clamp again
% Adaptive penalty update
if S ~= S_old
wf = min(wf * 1.10, wf_max);
else
wf = max(wf * 0.90, wf_min);
end
S_old = S;
end mpc control of solar pv MATLAB Answers — New Questions
Thread implemented in MATLAB in a timer
Hello,
I have two processes (one for a camera that runs through a camera function and one for a robot that runs through a robot function), and I’d like to set up a thread to run them in parallel.
I’d like the robot process to run in the background if possible. I searched the internet and found parfeval but I don’t really understand how it works.
I don’t really understand how it works. Can you advise me on how to do this?Hello,
I have two processes (one for a camera that runs through a camera function and one for a robot that runs through a robot function), and I’d like to set up a thread to run them in parallel.
I’d like the robot process to run in the background if possible. I searched the internet and found parfeval but I don’t really understand how it works.
I don’t really understand how it works. Can you advise me on how to do this? Hello,
I have two processes (one for a camera that runs through a camera function and one for a robot that runs through a robot function), and I’d like to set up a thread to run them in parallel.
I’d like the robot process to run in the background if possible. I searched the internet and found parfeval but I don’t really understand how it works.
I don’t really understand how it works. Can you advise me on how to do this? thread, matlab MATLAB Answers — New Questions
Mainframes Are the New AI Infrastructure. Protect it with Secure AI
If your AI workloads run in containers, then securing those containers is the first and most important step in protecting your AI. And as enterprises begin to deploy containerized AI workloads on Red Hat OpenShift for mainframe environments, that priority becomes even more urgent.
If your AI workloads run in containers, then securing those containers is the first and most important step in protecting your AI. And as enterprises begin to deploy containerized AI workloads on Red Hat OpenShift for mainframe environments, that priority becomes even more urgent.
Read More
Experimental Design in Matlab
Can anyone help me with run a complete CCD or BBD experimental design in matlab? Actually I use RStudio for run my DoE but i would like to learn how to perform these in Matlab.
I found this page https://it.mathworks.com/help/stats/design-of-experiments-1.html that give me some information but this is not enough…
I would like to know also the script for give the experimental responses, extimate coefficient, perform the ANOVA and response surface and so on..
Thank you so much!Can anyone help me with run a complete CCD or BBD experimental design in matlab? Actually I use RStudio for run my DoE but i would like to learn how to perform these in Matlab.
I found this page https://it.mathworks.com/help/stats/design-of-experiments-1.html that give me some information but this is not enough…
I would like to know also the script for give the experimental responses, extimate coefficient, perform the ANOVA and response surface and so on..
Thank you so much! Can anyone help me with run a complete CCD or BBD experimental design in matlab? Actually I use RStudio for run my DoE but i would like to learn how to perform these in Matlab.
I found this page https://it.mathworks.com/help/stats/design-of-experiments-1.html that give me some information but this is not enough…
I would like to know also the script for give the experimental responses, extimate coefficient, perform the ANOVA and response surface and so on..
Thank you so much! doe, ccd, bbd MATLAB Answers — New Questions
Solving ODE just for one time step
I want to solve some ODE using matlab solver (ode45, ode15s, etc) just for one time step. The time step is decided internally by the solver. Is this possible to do?I want to solve some ODE using matlab solver (ode45, ode15s, etc) just for one time step. The time step is decided internally by the solver. Is this possible to do? I want to solve some ODE using matlab solver (ode45, ode15s, etc) just for one time step. The time step is decided internally by the solver. Is this possible to do? ode, solver MATLAB Answers — New Questions
How do I put more than one patternCustom plot into a figure when it seems like neither subplot or tiledlayout will work?
I am using multiple patternCustom plots that use CoordinateSystem="polar", Slice="theta" that I would like to show in the same figure in a 2×3 format. It seems that neither tiledlayout or subplots will work. I would think there has to be a straightforward way to do this, that someone can show me.I am using multiple patternCustom plots that use CoordinateSystem="polar", Slice="theta" that I would like to show in the same figure in a 2×3 format. It seems that neither tiledlayout or subplots will work. I would think there has to be a straightforward way to do this, that someone can show me. I am using multiple patternCustom plots that use CoordinateSystem="polar", Slice="theta" that I would like to show in the same figure in a 2×3 format. It seems that neither tiledlayout or subplots will work. I would think there has to be a straightforward way to do this, that someone can show me. patterncustom, tiledlayout, subplot, figure, multiple plots MATLAB Answers — New Questions
Intersection points of multiple straight line segments
This feels as though it should be easy, but other than creating loops which for large data sets run for ever I can’t see how to do this
I have mulitple line segments with end points in the form [x11 y11 x12 y12; x21 y21 x22 y22;…] [x13 y13 x14 y14; x23 y23 x24 y24;…]
I am trying to find intersection points between any pair of line segments in the two lists
I know how to find where any specific two intersect, using xy = [x1*y2-x2*y1,x3*y4-x4*y3]/[y2-y1,y4-y3;-(x2-x1),-(x4-x3)]; and looping through each list in turn
but can’t see an efficient way of testing all possible pairs
Any help gratefully receivedThis feels as though it should be easy, but other than creating loops which for large data sets run for ever I can’t see how to do this
I have mulitple line segments with end points in the form [x11 y11 x12 y12; x21 y21 x22 y22;…] [x13 y13 x14 y14; x23 y23 x24 y24;…]
I am trying to find intersection points between any pair of line segments in the two lists
I know how to find where any specific two intersect, using xy = [x1*y2-x2*y1,x3*y4-x4*y3]/[y2-y1,y4-y3;-(x2-x1),-(x4-x3)]; and looping through each list in turn
but can’t see an efficient way of testing all possible pairs
Any help gratefully received This feels as though it should be easy, but other than creating loops which for large data sets run for ever I can’t see how to do this
I have mulitple line segments with end points in the form [x11 y11 x12 y12; x21 y21 x22 y22;…] [x13 y13 x14 y14; x23 y23 x24 y24;…]
I am trying to find intersection points between any pair of line segments in the two lists
I know how to find where any specific two intersect, using xy = [x1*y2-x2*y1,x3*y4-x4*y3]/[y2-y1,y4-y3;-(x2-x1),-(x4-x3)]; and looping through each list in turn
but can’t see an efficient way of testing all possible pairs
Any help gratefully received intersects MATLAB Answers — New Questions
I haven’t defined syms x but solve function gives me values depend on x
I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp])I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp]) I am designing a PID controller for which I set the denominator of my closed-loop transfer function equal to the product of the dominant poles and the residue polynomial.
My goal is to get values that depend on Ki, but even though I don’t use the syms x command, my values depend on x and Ki.
clear all;
clc;
syms zeta positive
syms s;
syms Kp Ki Kd;
% Given values
ts = 4; % Settling time
Mp = 0.05; % Maximum overshoot
% Define the overshoot equation
eq1 = exp(-zeta*pi / sqrt(1 – zeta^2)) == Mp;
% Solve for zeta numerically (only real positive solution makes sense)
zeta = double(vpasolve(eq1, zeta, [0 1]));
% Now calculate omega_n using Ts = 4 / (zeta * omega_n)
w_n = 4 / (zeta * ts);
G= (s+1)/(s^3 +6*s^2 +10*s -15)
H= 10/(s+10)
F= (Kd*s^2 + Kp*s + Ki)/s
Tcl= (F*G)/(1 + F*G*H)
[num, den] = numden(simplifyFraction(Tcl));
num = expand(num)
den = expand(den)
num_s = coeffs(num, s, ‘All’)
den_s = coeffs(den, s, ‘All’)
Pd=s^2 +2*zeta*w_n*s+(w_n)^2
syms e0 e1 e2 positive;
Pr= (s+e0)*(s+e1)*(s+e2)
Pe=expand(Pd*Pr)
Pe_s= coeffs(Pe,s,"All")
eq2 = Pe_s == den_s
sol2 = solve(eq2, [Kp, Kd, e0, e1, e2], ‘Real’, true);
% den_s=subs(den_s,[Kd,Kp],[sol2.Kd,sol2.Kp])
% F = subs(F,[Kd,Kp],[sol2.Kd,sol2.Kp]) solve MATLAB Answers — New Questions
Classification problem parsed as regression problem when Split Criterion is supplied to fitcensemble
Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1);Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1); Hi
I ran a hyperparameter optimization to find the best parameters for a two-class classification problem using _fitcensemble_. But when I try to use these I get a strange warning:
*Warning: You must pass ‘SplitCriterion’ as a character vector ‘mse’ for regression.*
What is wrong with my code? The warning comes when I use a boosting ensemble as ‘method’. When I remove the ‘SplitCriterion’ everything works fine, but I cannot understand why Matlab somewhere on the line thinks this is a regression problem when I use fit"c"ensemble.
Here is a toy example with arbitrarily chosen settings that you can run to reproduce the Warning/Error.
load carsmall
X = table(Acceleration,Cylinders,Displacement,Horsepower,Mfg,Model_Year,Weight,MPG);
X.Cylinders(X.Cylinders < 8) = 0; % Create two classes in the Cylinders variable
t = templateTree( ‘MaxNumSplits’, 30,…
‘MinLeafSize’, 10,…
‘SplitCriterion’, ‘gdi’);
classificationEnsemble = fitcensemble(X,’Cylinders’,…
‘Method’, ‘LogitBoost’, …
‘NumLearningCycles’,12,…
‘Learners’,t,…
‘KFold’,7,…
‘LearnRate’,0.1); fitcensemble, split criterion, classification, regression, hyperparameter, optimization, boost, templatetree MATLAB Answers — New Questions
How do I make a 10×10 showing all numbers 1 to 100?
how do i create a nested loop tht will provide me with a 10×10 matrix with all the numbers 1 to 100 like this
1 2 … 10
11 … … …
… … … …
… … … 100how do i create a nested loop tht will provide me with a 10×10 matrix with all the numbers 1 to 100 like this
1 2 … 10
11 … … …
… … … …
… … … 100 how do i create a nested loop tht will provide me with a 10×10 matrix with all the numbers 1 to 100 like this
1 2 … 10
11 … … …
… … … …
… … … 100 matrix loop nested MATLAB Answers — New Questions
Is it possible to get the version number of a compiled program inside the program? I am using the Application Compiler.
For a project I am working on, I would like the program to output the current version being used in a char array. I have the following code:
if(isdeployed)
version = (Help here);
version_message = [‘Now running program.exe version: ‘ version];
else
version = ‘script’;
version_message = [‘Now running program.m version: ‘ version];
end
disp(version_message);
Is it possible to dynamically get the version number, or do I have to manually set it to ensure they are the same? I know it can be done with App Designer, but this executable does not use App Designer.For a project I am working on, I would like the program to output the current version being used in a char array. I have the following code:
if(isdeployed)
version = (Help here);
version_message = [‘Now running program.exe version: ‘ version];
else
version = ‘script’;
version_message = [‘Now running program.m version: ‘ version];
end
disp(version_message);
Is it possible to dynamically get the version number, or do I have to manually set it to ensure they are the same? I know it can be done with App Designer, but this executable does not use App Designer. For a project I am working on, I would like the program to output the current version being used in a char array. I have the following code:
if(isdeployed)
version = (Help here);
version_message = [‘Now running program.exe version: ‘ version];
else
version = ‘script’;
version_message = [‘Now running program.m version: ‘ version];
end
disp(version_message);
Is it possible to dynamically get the version number, or do I have to manually set it to ensure they are the same? I know it can be done with App Designer, but this executable does not use App Designer. compiler, version number, matlab MATLAB Answers — New Questions
Same script, faster execution when running in a spawned instance (“!matlab …”)?
Dear Community,
I am running Matlab 2024b under Windows 10 / 32GB RAM on a 6-core laptop Intel CPU (hyperthreading deactivated). For the sake of runtime optimisation I have done the following comparison:
case #1: a script running within the current Matlab session (single instance) and
case #2: the same script running in a spawned session (instance), using "!matlab -nosplash -desktop -r "load …" (etc.).
The runtime results are as follows:
script #1 finished in about an hour, total CPU load ~50% at boost clock (single Matlab instance)
script #2 finished in about HALF an hour (!), similar total CPU load ~50% at boost clock; main Matlab instance idle (~0%), spawned instance ~40%
I muss admit I do not understand the results: why does a spawned Matlab instance (i.e. two instances running in parallel: main/idle and active) complete the task in half of the time, compared to a single instance?
What might be the reason for this behavior?
Thanks a lot in advance!
MarekDear Community,
I am running Matlab 2024b under Windows 10 / 32GB RAM on a 6-core laptop Intel CPU (hyperthreading deactivated). For the sake of runtime optimisation I have done the following comparison:
case #1: a script running within the current Matlab session (single instance) and
case #2: the same script running in a spawned session (instance), using "!matlab -nosplash -desktop -r "load …" (etc.).
The runtime results are as follows:
script #1 finished in about an hour, total CPU load ~50% at boost clock (single Matlab instance)
script #2 finished in about HALF an hour (!), similar total CPU load ~50% at boost clock; main Matlab instance idle (~0%), spawned instance ~40%
I muss admit I do not understand the results: why does a spawned Matlab instance (i.e. two instances running in parallel: main/idle and active) complete the task in half of the time, compared to a single instance?
What might be the reason for this behavior?
Thanks a lot in advance!
Marek Dear Community,
I am running Matlab 2024b under Windows 10 / 32GB RAM on a 6-core laptop Intel CPU (hyperthreading deactivated). For the sake of runtime optimisation I have done the following comparison:
case #1: a script running within the current Matlab session (single instance) and
case #2: the same script running in a spawned session (instance), using "!matlab -nosplash -desktop -r "load …" (etc.).
The runtime results are as follows:
script #1 finished in about an hour, total CPU load ~50% at boost clock (single Matlab instance)
script #2 finished in about HALF an hour (!), similar total CPU load ~50% at boost clock; main Matlab instance idle (~0%), spawned instance ~40%
I muss admit I do not understand the results: why does a spawned Matlab instance (i.e. two instances running in parallel: main/idle and active) complete the task in half of the time, compared to a single instance?
What might be the reason for this behavior?
Thanks a lot in advance!
Marek multiple instance spawn MATLAB Answers — New Questions
Find a certain number in a vector based on conditions
So I have a vector(A) of distances. I have a vector(B) of ranges. These ranges(B) are not equivalent to the size of the vector(A). I want to find the location of each range in the vector that corresponds to each distance value. Like if a distance is within the range. The range(B) is something like (m by 2) and the distances(A) are (n by 1)So I have a vector(A) of distances. I have a vector(B) of ranges. These ranges(B) are not equivalent to the size of the vector(A). I want to find the location of each range in the vector that corresponds to each distance value. Like if a distance is within the range. The range(B) is something like (m by 2) and the distances(A) are (n by 1) So I have a vector(A) of distances. I have a vector(B) of ranges. These ranges(B) are not equivalent to the size of the vector(A). I want to find the location of each range in the vector that corresponds to each distance value. Like if a distance is within the range. The range(B) is something like (m by 2) and the distances(A) are (n by 1) find, vector MATLAB Answers — New Questions
How to set variable names using Readtable with hierarchical categories (Excel file with merged cells / multiple header rows)
I have an Excel file with a series of header rows containing a hierarchy of descriptors. I would like to use this existing hierarchy to access the data. In the image below, I have data for various engineering majors (electical, mechincal, …) that are split by year of study (freshman, sophomore, …), then by gender, and finally my domestic versus international. This heirachy repeats for each major and there are many rows of data corresponding to academic years (not pictured in the table below) going back a long way. Is there a way to use readtable or a similar function to load that data in such a way that I can retrieve a specific number. For example, can I import the data in such a way that I could retrieve it with something like the following pseudo-code
table = readtable(‘filename’, <other options>)
table(major=electrical, gender=female, <additional options>)
% or even
table(row1=’electrical’, row2=’female’, <additional options>)
Alternatively, can I manipulate the way column names are created? WIthout any tweaking I get names like
‘dometic’, ‘domestic_1’, ‘domestic_2’, …
What I would prefer is to get column names such as
‘electrical-freshman-male-domestic’
‘electrical-freshman-female-domestic’
‘electrical-freshman-unspecified-domestic’
‘electrical-sophomore-male-domestic’
…
and likewise for other combinations so that I drill down to the appropriate column of data.I have an Excel file with a series of header rows containing a hierarchy of descriptors. I would like to use this existing hierarchy to access the data. In the image below, I have data for various engineering majors (electical, mechincal, …) that are split by year of study (freshman, sophomore, …), then by gender, and finally my domestic versus international. This heirachy repeats for each major and there are many rows of data corresponding to academic years (not pictured in the table below) going back a long way. Is there a way to use readtable or a similar function to load that data in such a way that I can retrieve a specific number. For example, can I import the data in such a way that I could retrieve it with something like the following pseudo-code
table = readtable(‘filename’, <other options>)
table(major=electrical, gender=female, <additional options>)
% or even
table(row1=’electrical’, row2=’female’, <additional options>)
Alternatively, can I manipulate the way column names are created? WIthout any tweaking I get names like
‘dometic’, ‘domestic_1’, ‘domestic_2’, …
What I would prefer is to get column names such as
‘electrical-freshman-male-domestic’
‘electrical-freshman-female-domestic’
‘electrical-freshman-unspecified-domestic’
‘electrical-sophomore-male-domestic’
…
and likewise for other combinations so that I drill down to the appropriate column of data. I have an Excel file with a series of header rows containing a hierarchy of descriptors. I would like to use this existing hierarchy to access the data. In the image below, I have data for various engineering majors (electical, mechincal, …) that are split by year of study (freshman, sophomore, …), then by gender, and finally my domestic versus international. This heirachy repeats for each major and there are many rows of data corresponding to academic years (not pictured in the table below) going back a long way. Is there a way to use readtable or a similar function to load that data in such a way that I can retrieve a specific number. For example, can I import the data in such a way that I could retrieve it with something like the following pseudo-code
table = readtable(‘filename’, <other options>)
table(major=electrical, gender=female, <additional options>)
% or even
table(row1=’electrical’, row2=’female’, <additional options>)
Alternatively, can I manipulate the way column names are created? WIthout any tweaking I get names like
‘dometic’, ‘domestic_1’, ‘domestic_2’, …
What I would prefer is to get column names such as
‘electrical-freshman-male-domestic’
‘electrical-freshman-female-domestic’
‘electrical-freshman-unspecified-domestic’
‘electrical-sophomore-male-domestic’
…
and likewise for other combinations so that I drill down to the appropriate column of data. readtable, readcell, table MATLAB Answers — New Questions
Wave simulation
Hello
I’m trying to simulate a single source wave in matlab
does anyone know how to do that? (code tips)
ThanksHello
I’m trying to simulate a single source wave in matlab
does anyone know how to do that? (code tips)
Thanks Hello
I’m trying to simulate a single source wave in matlab
does anyone know how to do that? (code tips)
Thanks wave, matlab, array, plotting, matlab gui, graph, simulation, code generation, 2d MATLAB Answers — New Questions
How to check Matlab code Plagiarism
How can we check MATLAB code plagiarism? Is there any software available?How can we check MATLAB code plagiarism? Is there any software available? How can we check MATLAB code plagiarism? Is there any software available? plagiarism, cheating, copying MATLAB Answers — New Questions
any one help me to correct this code or help me my I have a graduation project coming soon
clear; close all; clc;
warning(‘off’, ‘all’);
[contentFile, contentPath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة المحتوى’);
if isequal(contentFile, 0)
error(‘لم يتم اختيار صورة محتوى’);
end
contentImage = imread(fullfile(contentPath, contentFile));
[styleFile, stylePath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة النمط’);
if isequal(styleFile, 0)
error(‘لم يتم اختيار صورة نمط’);
end
styleImage = imread(fullfile(stylePath, styleFile));
contentImage = im2double(contentImage);
styleImage = im2double(styleImage);
if size(contentImage,3) == 1
contentImage = repmat(contentImage, [1 1 3]);
end
if size(styleImage,3) == 1
styleImage = repmat(styleImage, [1 1 3]);
end
styleImage = imadjust(styleImage, [0.1 0.9], []);
styleImage = imgaussfilt(styleImage, 1);
net = vgg19();
inputSize = net.Layers(1).InputSize(1:2);
% تغيير حجم الصور مع الحفاظ على التناسب
contentImage = imresize(contentImage, inputSize);
styleImage = imresize(styleImage, inputSize);
%% 4. تحديد الطبقات الصحيحة
contentLayer = ‘conv4_2’;
styleLayers = {‘conv1_1’, ‘conv2_1’, ‘conv3_1’, ‘conv4_1’, ‘conv5_1’};
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
numIterations = 500;
learningRate = 0.01;
styleWeight = 1e6;
dlContent = dlarray(contentImage, ‘SSC’);
dlTransform = dlContent;
figure;
for iter = 1:numIterations
[grad, loss] = dlfeval(@computeGradients, dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight);
dlTransform = dlTransform – learningRate * grad;
if mod(iter,50) == 0 || iter == 1
fprintf(‘التكرار %d: الخسارة الكلية=%.2f, المحتوى=%.2f, النمط=%.2fn’, …
iter, loss.total, loss.content, loss.style);
% عرض التقدم
currentImg = uint8(extractdata(dlTransform)*255);
imshow(currentImg);
title(sprintf(‘التكرار %d/%d’, iter, numIterations));
drawnow;
end
end
outputImage = uint8(extractdata(dlTransform)*255);
[~,name,ext] = fileparts(contentFile);
outputFile = fullfile(pwd, [name ‘_styled’ ext]);
imwrite(outputImage, outputFile);
fprintf(‘تم حفظ الصورة الناتجة بنجاح في: %sn’, outputFile);
function features = getStyleFeatures(styleImg, net, styleLayers)
if ~ismatrix(styleImg) && ~(ndims(styleImg)==3)
error(‘يجب أن تكون صورة النمط مصفوفة 2D أو 3D’);
end
if size(styleImg,3) ~= 3
error(‘يجب أن تحتوي صورة النمط على 3 قنوات لونية (RGB)’);
end
try
dlStyle = dlarray(styleImg, ‘SSC’);
catch
error(‘فشل تحويل صورة النمط إلى dlarray’);
end
features = struct();
for i = 1:length(styleLayers)
layer = styleLayers{i};
try
dlFeatures = activations(net, dlStyle, layer);
features.(layer) = computeGramMatrix(dlFeatures);
catch ME
error(‘فشل في استخراج خصائص الطبقة %s: %s’, layer, ME.message);
end
end
end
function gramMatrix = computeGramMatrix(features)
[H,W,C] = size(features);
reshaped = reshape(features, H*W, C);
gramMatrix = reshaped’ * reshaped / (H*W*C);
end
function [gradients, loss] = computeGradients(dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight)
contentFeatures = activations(net, dlContent, contentLayer);
transformContentFeatures = activations(net, dlTransform, contentLayer);
contentLoss = mean((transformContentFeatures – contentFeatures).^2);
styleLoss = 0;
for i = 1:length(styleLayers)
layer = styleLayers{i};
transformFeatures = activations(net, dlTransform, layer);
gramTransform = computeGramMatrix(transformFeatures);
gramStyle = styleFeatures.(layer);
styleLoss = styleLoss + mean((gramTransform – gramStyle).^2);
end
styleLoss = styleLoss / length(styleLayers);
totalLoss = contentLoss + styleWeight * styleLoss;
gradients = dlgradient(totalLoss, dlTransform);
loss.total = double(totalLoss);
loss.content = double(contentLoss);
loss.style = double(styleLoss);
end
%%%%
erorr
rror using styletransfer>getStyleFeatures (line 111)
فشل في استخراج خصائص الطبقة conv1_1: Invalid 2-D image data. Specify image data as a 3-D numeric array containing a single image, a
4-D numeric array containing multiple images, a datastore, or a table containing image file paths or images in the first column.
Error in styletransfer (line 48)
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^clear; close all; clc;
warning(‘off’, ‘all’);
[contentFile, contentPath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة المحتوى’);
if isequal(contentFile, 0)
error(‘لم يتم اختيار صورة محتوى’);
end
contentImage = imread(fullfile(contentPath, contentFile));
[styleFile, stylePath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة النمط’);
if isequal(styleFile, 0)
error(‘لم يتم اختيار صورة نمط’);
end
styleImage = imread(fullfile(stylePath, styleFile));
contentImage = im2double(contentImage);
styleImage = im2double(styleImage);
if size(contentImage,3) == 1
contentImage = repmat(contentImage, [1 1 3]);
end
if size(styleImage,3) == 1
styleImage = repmat(styleImage, [1 1 3]);
end
styleImage = imadjust(styleImage, [0.1 0.9], []);
styleImage = imgaussfilt(styleImage, 1);
net = vgg19();
inputSize = net.Layers(1).InputSize(1:2);
% تغيير حجم الصور مع الحفاظ على التناسب
contentImage = imresize(contentImage, inputSize);
styleImage = imresize(styleImage, inputSize);
%% 4. تحديد الطبقات الصحيحة
contentLayer = ‘conv4_2’;
styleLayers = {‘conv1_1’, ‘conv2_1’, ‘conv3_1’, ‘conv4_1’, ‘conv5_1’};
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
numIterations = 500;
learningRate = 0.01;
styleWeight = 1e6;
dlContent = dlarray(contentImage, ‘SSC’);
dlTransform = dlContent;
figure;
for iter = 1:numIterations
[grad, loss] = dlfeval(@computeGradients, dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight);
dlTransform = dlTransform – learningRate * grad;
if mod(iter,50) == 0 || iter == 1
fprintf(‘التكرار %d: الخسارة الكلية=%.2f, المحتوى=%.2f, النمط=%.2fn’, …
iter, loss.total, loss.content, loss.style);
% عرض التقدم
currentImg = uint8(extractdata(dlTransform)*255);
imshow(currentImg);
title(sprintf(‘التكرار %d/%d’, iter, numIterations));
drawnow;
end
end
outputImage = uint8(extractdata(dlTransform)*255);
[~,name,ext] = fileparts(contentFile);
outputFile = fullfile(pwd, [name ‘_styled’ ext]);
imwrite(outputImage, outputFile);
fprintf(‘تم حفظ الصورة الناتجة بنجاح في: %sn’, outputFile);
function features = getStyleFeatures(styleImg, net, styleLayers)
if ~ismatrix(styleImg) && ~(ndims(styleImg)==3)
error(‘يجب أن تكون صورة النمط مصفوفة 2D أو 3D’);
end
if size(styleImg,3) ~= 3
error(‘يجب أن تحتوي صورة النمط على 3 قنوات لونية (RGB)’);
end
try
dlStyle = dlarray(styleImg, ‘SSC’);
catch
error(‘فشل تحويل صورة النمط إلى dlarray’);
end
features = struct();
for i = 1:length(styleLayers)
layer = styleLayers{i};
try
dlFeatures = activations(net, dlStyle, layer);
features.(layer) = computeGramMatrix(dlFeatures);
catch ME
error(‘فشل في استخراج خصائص الطبقة %s: %s’, layer, ME.message);
end
end
end
function gramMatrix = computeGramMatrix(features)
[H,W,C] = size(features);
reshaped = reshape(features, H*W, C);
gramMatrix = reshaped’ * reshaped / (H*W*C);
end
function [gradients, loss] = computeGradients(dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight)
contentFeatures = activations(net, dlContent, contentLayer);
transformContentFeatures = activations(net, dlTransform, contentLayer);
contentLoss = mean((transformContentFeatures – contentFeatures).^2);
styleLoss = 0;
for i = 1:length(styleLayers)
layer = styleLayers{i};
transformFeatures = activations(net, dlTransform, layer);
gramTransform = computeGramMatrix(transformFeatures);
gramStyle = styleFeatures.(layer);
styleLoss = styleLoss + mean((gramTransform – gramStyle).^2);
end
styleLoss = styleLoss / length(styleLayers);
totalLoss = contentLoss + styleWeight * styleLoss;
gradients = dlgradient(totalLoss, dlTransform);
loss.total = double(totalLoss);
loss.content = double(contentLoss);
loss.style = double(styleLoss);
end
%%%%
erorr
rror using styletransfer>getStyleFeatures (line 111)
فشل في استخراج خصائص الطبقة conv1_1: Invalid 2-D image data. Specify image data as a 3-D numeric array containing a single image, a
4-D numeric array containing multiple images, a datastore, or a table containing image file paths or images in the first column.
Error in styletransfer (line 48)
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ clear; close all; clc;
warning(‘off’, ‘all’);
[contentFile, contentPath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة المحتوى’);
if isequal(contentFile, 0)
error(‘لم يتم اختيار صورة محتوى’);
end
contentImage = imread(fullfile(contentPath, contentFile));
[styleFile, stylePath] = uigetfile({‘*.bmp;*.jpg;*.png;*.tif’, ‘ملفات الصور’}, ‘اختر صورة النمط’);
if isequal(styleFile, 0)
error(‘لم يتم اختيار صورة نمط’);
end
styleImage = imread(fullfile(stylePath, styleFile));
contentImage = im2double(contentImage);
styleImage = im2double(styleImage);
if size(contentImage,3) == 1
contentImage = repmat(contentImage, [1 1 3]);
end
if size(styleImage,3) == 1
styleImage = repmat(styleImage, [1 1 3]);
end
styleImage = imadjust(styleImage, [0.1 0.9], []);
styleImage = imgaussfilt(styleImage, 1);
net = vgg19();
inputSize = net.Layers(1).InputSize(1:2);
% تغيير حجم الصور مع الحفاظ على التناسب
contentImage = imresize(contentImage, inputSize);
styleImage = imresize(styleImage, inputSize);
%% 4. تحديد الطبقات الصحيحة
contentLayer = ‘conv4_2’;
styleLayers = {‘conv1_1’, ‘conv2_1’, ‘conv3_1’, ‘conv4_1’, ‘conv5_1’};
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
numIterations = 500;
learningRate = 0.01;
styleWeight = 1e6;
dlContent = dlarray(contentImage, ‘SSC’);
dlTransform = dlContent;
figure;
for iter = 1:numIterations
[grad, loss] = dlfeval(@computeGradients, dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight);
dlTransform = dlTransform – learningRate * grad;
if mod(iter,50) == 0 || iter == 1
fprintf(‘التكرار %d: الخسارة الكلية=%.2f, المحتوى=%.2f, النمط=%.2fn’, …
iter, loss.total, loss.content, loss.style);
% عرض التقدم
currentImg = uint8(extractdata(dlTransform)*255);
imshow(currentImg);
title(sprintf(‘التكرار %d/%d’, iter, numIterations));
drawnow;
end
end
outputImage = uint8(extractdata(dlTransform)*255);
[~,name,ext] = fileparts(contentFile);
outputFile = fullfile(pwd, [name ‘_styled’ ext]);
imwrite(outputImage, outputFile);
fprintf(‘تم حفظ الصورة الناتجة بنجاح في: %sn’, outputFile);
function features = getStyleFeatures(styleImg, net, styleLayers)
if ~ismatrix(styleImg) && ~(ndims(styleImg)==3)
error(‘يجب أن تكون صورة النمط مصفوفة 2D أو 3D’);
end
if size(styleImg,3) ~= 3
error(‘يجب أن تحتوي صورة النمط على 3 قنوات لونية (RGB)’);
end
try
dlStyle = dlarray(styleImg, ‘SSC’);
catch
error(‘فشل تحويل صورة النمط إلى dlarray’);
end
features = struct();
for i = 1:length(styleLayers)
layer = styleLayers{i};
try
dlFeatures = activations(net, dlStyle, layer);
features.(layer) = computeGramMatrix(dlFeatures);
catch ME
error(‘فشل في استخراج خصائص الطبقة %s: %s’, layer, ME.message);
end
end
end
function gramMatrix = computeGramMatrix(features)
[H,W,C] = size(features);
reshaped = reshape(features, H*W, C);
gramMatrix = reshaped’ * reshaped / (H*W*C);
end
function [gradients, loss] = computeGradients(dlTransform, dlContent, net, …
contentLayer, styleLayers, styleFeatures, styleWeight)
contentFeatures = activations(net, dlContent, contentLayer);
transformContentFeatures = activations(net, dlTransform, contentLayer);
contentLoss = mean((transformContentFeatures – contentFeatures).^2);
styleLoss = 0;
for i = 1:length(styleLayers)
layer = styleLayers{i};
transformFeatures = activations(net, dlTransform, layer);
gramTransform = computeGramMatrix(transformFeatures);
gramStyle = styleFeatures.(layer);
styleLoss = styleLoss + mean((gramTransform – gramStyle).^2);
end
styleLoss = styleLoss / length(styleLayers);
totalLoss = contentLoss + styleWeight * styleLoss;
gradients = dlgradient(totalLoss, dlTransform);
loss.total = double(totalLoss);
loss.content = double(contentLoss);
loss.style = double(styleLoss);
end
%%%%
erorr
rror using styletransfer>getStyleFeatures (line 111)
فشل في استخراج خصائص الطبقة conv1_1: Invalid 2-D image data. Specify image data as a 3-D numeric array containing a single image, a
4-D numeric array containing multiple images, a datastore, or a table containing image file paths or images in the first column.
Error in styletransfer (line 48)
styleFeatures = getStyleFeatures(styleImage, net, styleLayers);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ai, fast style transfer, deep learning, transfer learning MATLAB Answers — New Questions
Gradient based sharpness identifictaion in an image
Hi,
I am trying to identify sharply focused portions in the attached image using imgradient operator in the matlab. I have used "sobel" method.
I have to do this operation on many images, I am wondering is there any way to apply some thresolding while implementing imgradient or (any similar operator) in the matlab.
load matlab; imshow(II,[])Hi,
I am trying to identify sharply focused portions in the attached image using imgradient operator in the matlab. I have used "sobel" method.
I have to do this operation on many images, I am wondering is there any way to apply some thresolding while implementing imgradient or (any similar operator) in the matlab.
load matlab; imshow(II,[]) Hi,
I am trying to identify sharply focused portions in the attached image using imgradient operator in the matlab. I have used "sobel" method.
I have to do this operation on many images, I am wondering is there any way to apply some thresolding while implementing imgradient or (any similar operator) in the matlab.
load matlab; imshow(II,[]) edge detection, image processing, imgradient, sobel MATLAB Answers — New Questions
Has the MEX function (mxGetComplexDoubles) been deprecated in R2024b?
I am preparing a MEX file that includes the function: (mxGetComplexDoubles).
I tried to compile and link it to get the executable file (*. mexw64) corresponding to the source file: (*.F) using either of the following commands:
mex -R2018a filename.F
mex -R2018a -I"C:Program FilesMATLABR2024bexterninclude" -L"C:Program FilesMATLABR2024bexternlibwin64microsoft" -llibmex -llibmx filename.F
The compilation was successful; however, the linking was not because:
unresolved external symbol mxgetcomplexdoubles800
This happened despite my file containing the command (mxGetComplexDoubles) rather than the command (mxGetComplexDoubles800).
Surprisingly, upon searching for (mxGetComplexDoubles), I found that it is not there in:
"C:Program FilesMATLABR2024bbinwin64libmex.dll"
"C:Program FilesMATLABR2024bbinwin64libmat.dll"
My questions:
Has the function (mxGetComplexDoubles) been deprecated in R2024b?
What should I do in that case?I am preparing a MEX file that includes the function: (mxGetComplexDoubles).
I tried to compile and link it to get the executable file (*. mexw64) corresponding to the source file: (*.F) using either of the following commands:
mex -R2018a filename.F
mex -R2018a -I"C:Program FilesMATLABR2024bexterninclude" -L"C:Program FilesMATLABR2024bexternlibwin64microsoft" -llibmex -llibmx filename.F
The compilation was successful; however, the linking was not because:
unresolved external symbol mxgetcomplexdoubles800
This happened despite my file containing the command (mxGetComplexDoubles) rather than the command (mxGetComplexDoubles800).
Surprisingly, upon searching for (mxGetComplexDoubles), I found that it is not there in:
"C:Program FilesMATLABR2024bbinwin64libmex.dll"
"C:Program FilesMATLABR2024bbinwin64libmat.dll"
My questions:
Has the function (mxGetComplexDoubles) been deprecated in R2024b?
What should I do in that case? I am preparing a MEX file that includes the function: (mxGetComplexDoubles).
I tried to compile and link it to get the executable file (*. mexw64) corresponding to the source file: (*.F) using either of the following commands:
mex -R2018a filename.F
mex -R2018a -I"C:Program FilesMATLABR2024bexterninclude" -L"C:Program FilesMATLABR2024bexternlibwin64microsoft" -llibmex -llibmx filename.F
The compilation was successful; however, the linking was not because:
unresolved external symbol mxgetcomplexdoubles800
This happened despite my file containing the command (mxGetComplexDoubles) rather than the command (mxGetComplexDoubles800).
Surprisingly, upon searching for (mxGetComplexDoubles), I found that it is not there in:
"C:Program FilesMATLABR2024bbinwin64libmex.dll"
"C:Program FilesMATLABR2024bbinwin64libmat.dll"
My questions:
Has the function (mxGetComplexDoubles) been deprecated in R2024b?
What should I do in that case? mex function mxgetcomplexdoubles MATLAB Answers — New Questions