Month: May 2025
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
Microsoft Extends DLP Policy for Copilot to Office Apps
Same DLP Policy for Copilot Used to Block BizChat
On May 1, Microsoft announced that the public preview of the DLP policy for Microsoft 365 Copilot is effective for the Office apps (MC1059677, 21 April 2025, Microsoft 365 roadmap item 423483). The new functionality is an extension of the DLP policy introduced in March 2025. At that time, the policy only covered Microsoft 365 Copilot Chat (BizChat). Its extension to cover the Office apps (desktop and web) is logical, even if the implementation is different. We’ll get to what those differences are shortly.
How the DLP Policy for Copilot Works
As a quick refresher, the DLP policy for Copilot works by checking if a file is assigned a specific sensitivity label. If true, the Copilot functionality built into the app is limited and the content of the file cannot be used in Copilot responses, such as creating a document summary.
Apps are responsible for checking if a DLP policy is active within the tenant and what sensitivity labels are associated with the policy, so the announcement marks the inclusion of the necessary code in the Office apps to check for the DLP policy. I tested with Microsoft 365 Enterprise Apps version 2504 (build 18730.20122).
Like any other DLP policy, the policy can have multiple rules. In this case, rules for the DLP policy for Copilot block access for a sensitivity label, so if you want to block access for multiple sensitivity labels, the DLP policy has a separate rule for each label. If you created the DLP policy for Copilot to use with BizChat, you don’t need to do anything to extend the policy to cover the Office apps.
Using the DLP Policy for Copilot in Word
As an example, I created a Word document and tested that all the Copilot functionality worked as expected. I saved the document and reopened it to force Copilot to generate the automatic summary.
I then applied one of the sensitivity labels covered by a rule in the DLP policy for Copilot and tried out some of the Copilot features. As you can see from Figure 1, the automatic summary was not removed (but the summary cannot be updated), and asking Copilot to explicitly summarize the document fails because “your organization’s policy doesn’t allow it.” However, it looks like Copilot can query the content of the document to answer questions in chat.

In their announcement, Microsoft says that “Copilot actions like summarizing or auto-generating content directly in the canvas are blocked.” They also say that chatting with Copilot is also blocked, but as you can see in Figure 1, Copilot answered a predefined question (“What is the purpose of DLP for M365 Copilot”) quite happily. On the other hand, if you go to the Message Copilot section and input the same question, Copilot refuses to answer. The block on chat worked in the web app but not always in the desktop version of Word (but this is preview software, so some bugs are expected).
Finally, Copilot cannot reference a file protected by one of the sensitivity labels covered by the DLP policy (an action that forces Copilot to extract the content of the referenced document).
Maybe Just Turn Copilot Off
I’ve used Copilot for nearly two years, and I was initially confused by the effect the DLP policy for Copilot has on the Office apps. To me, it would be simpler and more understandable to disable Copilot completely for documents within the scope of the DLP policy. I would remove the Copilot button from the menu bar and make sure that no UI elements that expose any Copilot feature, like the automatic summary appear. Right now, the UI is a confusing mishmash of things that work and stuff that doesn’t that needs to be cleaned up.
Learn how to exploit the data available to Microsoft 365 tenant administrators through the Office 365 for IT Pros eBook. We love figuring out how things work.
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
coneprog 代码生成过程中报错:’secondordercone’ not supported for code generation.
coneprog 代码生成coneprog 代码生成 coneprog 代码生成 transferred 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
How to save the proceesed image in the same size as input image
Hi,
I need to save the proceesed image in the same size (width and height) as the input image. I tried below script, but it still saves teh image in the smaller size than the input same.
width=2472;
height=2062;
set(gcf,’position’,[x0,y0,width,height])Hi,
I need to save the proceesed image in the same size (width and height) as the input image. I tried below script, but it still saves teh image in the smaller size than the input same.
width=2472;
height=2062;
set(gcf,’position’,[x0,y0,width,height]) Hi,
I need to save the proceesed image in the same size (width and height) as the input image. I tried below script, but it still saves teh image in the smaller size than the input same.
width=2472;
height=2062;
set(gcf,’position’,[x0,y0,width,height]) image processing, image saving, image size MATLAB Answers — New Questions
Remove outliers but be careful with end points
Hi, I have some typcial data like this that I want to remove the outliers (red arrows)
I use the rmoutliers function and then fillmissing to handle these.
%For last plotted Data
ax=app.UIAxes3;
[datax,datay] = getDataFromGraph(app,ax,1); % my fucntion that gets the last plot x and y values.
A=[datax datay];
[B,TFrm,TFoutlier] = rmoutliers(A,"movmedian",10);
x=B(:,1); y=B(:,2); hold(ax,"on");
The contraint I have is if I remove an outlier from the 1st or last data point (i.e. green arrow above), then it MUST be replaced with e.g the nearest non outlier.
So I thought this would do it:
F = fillmissing(y,’linear’,’EndValues’,’nearest’); %F = fillmissing(y,’movmedian’,10);
plot(ax,x,F,’.-‘);
However, its ignoring the last point (I dont mind other outliers being ignored, I just need the starting x and finishing x to be the same as the original data
ThanksHi, I have some typcial data like this that I want to remove the outliers (red arrows)
I use the rmoutliers function and then fillmissing to handle these.
%For last plotted Data
ax=app.UIAxes3;
[datax,datay] = getDataFromGraph(app,ax,1); % my fucntion that gets the last plot x and y values.
A=[datax datay];
[B,TFrm,TFoutlier] = rmoutliers(A,"movmedian",10);
x=B(:,1); y=B(:,2); hold(ax,"on");
The contraint I have is if I remove an outlier from the 1st or last data point (i.e. green arrow above), then it MUST be replaced with e.g the nearest non outlier.
So I thought this would do it:
F = fillmissing(y,’linear’,’EndValues’,’nearest’); %F = fillmissing(y,’movmedian’,10);
plot(ax,x,F,’.-‘);
However, its ignoring the last point (I dont mind other outliers being ignored, I just need the starting x and finishing x to be the same as the original data
Thanks Hi, I have some typcial data like this that I want to remove the outliers (red arrows)
I use the rmoutliers function and then fillmissing to handle these.
%For last plotted Data
ax=app.UIAxes3;
[datax,datay] = getDataFromGraph(app,ax,1); % my fucntion that gets the last plot x and y values.
A=[datax datay];
[B,TFrm,TFoutlier] = rmoutliers(A,"movmedian",10);
x=B(:,1); y=B(:,2); hold(ax,"on");
The contraint I have is if I remove an outlier from the 1st or last data point (i.e. green arrow above), then it MUST be replaced with e.g the nearest non outlier.
So I thought this would do it:
F = fillmissing(y,’linear’,’EndValues’,’nearest’); %F = fillmissing(y,’movmedian’,10);
plot(ax,x,F,’.-‘);
However, its ignoring the last point (I dont mind other outliers being ignored, I just need the starting x and finishing x to be the same as the original data
Thanks rmoutliers, fillmissing MATLAB Answers — New Questions
Capabilities of mass action kinetics
Hi,
I have a molecule A. Molecule A can undergo a system of reactions as seen in the figure below.
Basically it can undergo a network of reactions (a custom combination of parallel and consequetive reversible steps ending with a final irreversible step). I have the rate constants (both forward and reverse for reversible steps) for all these steps.
Tilll now, i have been manually coding the time evolution of systems like these, using a system of first order coupled linear differential equations (solving a master equation). But the networks are getting complicated.
Solving this would get easier if I could use a MATLAB app which would help me build a network without manually coding it in.
Recently I came across this "Mass Action Kinetics" module in matlab. Does this module have the capability to solve systems like this? Is there anything else MATLAB has that can help me.
Thanks!Hi,
I have a molecule A. Molecule A can undergo a system of reactions as seen in the figure below.
Basically it can undergo a network of reactions (a custom combination of parallel and consequetive reversible steps ending with a final irreversible step). I have the rate constants (both forward and reverse for reversible steps) for all these steps.
Tilll now, i have been manually coding the time evolution of systems like these, using a system of first order coupled linear differential equations (solving a master equation). But the networks are getting complicated.
Solving this would get easier if I could use a MATLAB app which would help me build a network without manually coding it in.
Recently I came across this "Mass Action Kinetics" module in matlab. Does this module have the capability to solve systems like this? Is there anything else MATLAB has that can help me.
Thanks! Hi,
I have a molecule A. Molecule A can undergo a system of reactions as seen in the figure below.
Basically it can undergo a network of reactions (a custom combination of parallel and consequetive reversible steps ending with a final irreversible step). I have the rate constants (both forward and reverse for reversible steps) for all these steps.
Tilll now, i have been manually coding the time evolution of systems like these, using a system of first order coupled linear differential equations (solving a master equation). But the networks are getting complicated.
Solving this would get easier if I could use a MATLAB app which would help me build a network without manually coding it in.
Recently I came across this "Mass Action Kinetics" module in matlab. Does this module have the capability to solve systems like this? Is there anything else MATLAB has that can help me.
Thanks! differential equations, matrix manipulation, kinetics MATLAB Answers — New Questions
Editing an Aircraft Actor in Simulink-Unreal Simulation
Hello,
As part of my project, I am simulating an aircraft using Simulink, and I have set up a Simulink system to communicate with Unreal Engine (as shown in the attached image). The issue I’m facing is that when I open the Unreal project AutoVrtlEnv, which is ported from MATLAB to Unreal, I can edit the airport scene but not the aircraft itself. The aircraft is an actor class that is dynamically spawned in Unreal via the Simulation 3D Aircraft Block.
The problem is that this aircraft actor (as shown in the attached image) does not exist when the simulation is not running—it only appears once the simulation starts. While I can technically edit these dynamically spawned actors by pausing the simulation, any changes I make are lost when the simulation restarts, as the actors are recreated from scratch.
I need to modify the Sim3dMainCamera under the Sim3dMWAirliner actor class. Is there a way to modify or duplicate it so that I can edit it as a separate class without losing my changes?
Any guidance would be greatly appreciated!Hello,
As part of my project, I am simulating an aircraft using Simulink, and I have set up a Simulink system to communicate with Unreal Engine (as shown in the attached image). The issue I’m facing is that when I open the Unreal project AutoVrtlEnv, which is ported from MATLAB to Unreal, I can edit the airport scene but not the aircraft itself. The aircraft is an actor class that is dynamically spawned in Unreal via the Simulation 3D Aircraft Block.
The problem is that this aircraft actor (as shown in the attached image) does not exist when the simulation is not running—it only appears once the simulation starts. While I can technically edit these dynamically spawned actors by pausing the simulation, any changes I make are lost when the simulation restarts, as the actors are recreated from scratch.
I need to modify the Sim3dMainCamera under the Sim3dMWAirliner actor class. Is there a way to modify or duplicate it so that I can edit it as a separate class without losing my changes?
Any guidance would be greatly appreciated! Hello,
As part of my project, I am simulating an aircraft using Simulink, and I have set up a Simulink system to communicate with Unreal Engine (as shown in the attached image). The issue I’m facing is that when I open the Unreal project AutoVrtlEnv, which is ported from MATLAB to Unreal, I can edit the airport scene but not the aircraft itself. The aircraft is an actor class that is dynamically spawned in Unreal via the Simulation 3D Aircraft Block.
The problem is that this aircraft actor (as shown in the attached image) does not exist when the simulation is not running—it only appears once the simulation starts. While I can technically edit these dynamically spawned actors by pausing the simulation, any changes I make are lost when the simulation restarts, as the actors are recreated from scratch.
I need to modify the Sim3dMainCamera under the Sim3dMWAirliner actor class. Is there a way to modify or duplicate it so that I can edit it as a separate class without losing my changes?
Any guidance would be greatly appreciated! simulink, simulation, unreal engine MATLAB Answers — New Questions
Generate n random numbers between 0.1 and 0.9 without repetition
Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks.Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks. Hi all,
I need to generate random points where and , excluding the point . My attempt is the following:
%define the lower limit
lower_limit = 0.1;
%define the upper limit
higher_limit = 0.9;
%No of random points
No_pts = 20;
%excluding value
No_value = 0.5
%Generate
valid_vals = setdiff(lower_limit:higher_limit, No_value);
result = valid_vals( randi(length(valid_vals), No_pts, 2) );
When running this code I only get one value which is . Any idea how this can be modified to work properly?
Thanks. random, points, vectors, matlab MATLAB Answers — New Questions
The Return of the General Channel
Teams Can Have a General Channel Just Like Before
In July 2024, Microsoft announced that team owners would be able to rename the General channel (or local language value) of teams. The idea was that “General” is just too general in nature and that it would be better if team owners could assign a more meaningful name to the first channel created in a team. Once
Now Microsoft has reversed course a tad. Message center notification MC1048628 (updated 9 April 2025) says that team owners can choose General as the name for the first channel. The new channel creation UI even has a button to set the channel name to “General” (Figure 1). The change is already effective in targeted release tenants and will roll out worldwide in mid-May 2025.

The big thing about using General as the default channel name is that the General channel is always listed first in the channels for a team. If you use a different name for the first channel, Teams orders the channel list alphabetically. You can see the effect of renaming the General channel in Figure 2.

Channel Creation Made Easier
MC1053645 (11 April 2025, Microsoft 365 roadmap item 479744) describes another channel-related change that will roll out to targeted release tenants in early May. The option to create a new channel is now present in the New Items menu (Figure 2).

Recent conference appearances by the Teams development group have emphasized that users should create channels rather than new teams. With 1,000 channels available in a team, there’s lots of room to avoid creating new teams with the attendant overhead that comes with a team. The more teams in a tenant, the higher the likelihood for digital debris. That wasn’t such a problem years ago, but digital debris can influence the accuracy and usefulness of AI-generated content, so it’s a real issue now.
No More Code Snippets
In other Teams news related to channels, MC1055554 (15 April 2025) announces the retirement of the code snippets feature in chat and channel conversations starting May 30, 2025. Microsoft is replacing code snippets with code blocks. Type /code in the editor or click on the code block icon in the menu bar to insert a new block, and then select the type of code so that the block displays the code appropriately (Figure 4).

Microsoft believes that code blocks are faster and more efficient. Line numbers aren’t current available in code blocks but will be soon, and code blocks will also be viewable on mobile clients.
You might ask what’s driving the change. I think it’s a matter of Teams dropping an older component that doesn’t probably get much use for a shared component that’s under active development. Microsoft says that the change will allow users to “create, edit, and share code directly in the compose box without needing a title.” That’s true when someone composes a message, but if you want channel or chat members to be able to edit code in a code block, considering using the Loop paragraph component and format it as code (Figure 5).

Posting a Loop component to a channel allows team members to edit the content, so it’s possible to have real-time collaboration to discuss code issues and potential solutions. Loop components posted in this manner are stored in the channel folder in the document library of the SharePoint Online site belonging to the team.
Adieu Classic Teams
Another change that’s coming up is that the classic Teams client will be unavailable after July 1, 2025 (MC1059667, 21 April 2025). Microsoft will block attempted access to Teams with the classic client after that date. It really is time to embrace the new (well, slightly used) Teams client.
Learn about using Teams and the rest of Microsoft 365 by subscribing to the Office 365 for IT Pros eBook. Use our experience to understand what’s important and how best to protect your tenant.