Category: News
Difference between integral and cumtrapz.
I have a tempral data series, which I need to integrate. In order to understand how Matlab does that, I start with a parabola as the data series. Could you guys please explain me why I get completely different results using the integral and cumtrapz funtions? The cumtrapz is giving me a cubic function, but I have no idea why it is only positive and I also do not understand the limits. My understanding is that the answer should be simple: intfx = x^3/3…
x = [-10:0.01:10]’;
fx = x.^2;
% intfx = integral(@(x) fx, x(1), x(end), ‘ArrayValued’, true);
intfx = cumtrapz(fx,x);
plot(x,fx,’b’)
hold on
plot(x,intfx,’r’)I have a tempral data series, which I need to integrate. In order to understand how Matlab does that, I start with a parabola as the data series. Could you guys please explain me why I get completely different results using the integral and cumtrapz funtions? The cumtrapz is giving me a cubic function, but I have no idea why it is only positive and I also do not understand the limits. My understanding is that the answer should be simple: intfx = x^3/3…
x = [-10:0.01:10]’;
fx = x.^2;
% intfx = integral(@(x) fx, x(1), x(end), ‘ArrayValued’, true);
intfx = cumtrapz(fx,x);
plot(x,fx,’b’)
hold on
plot(x,intfx,’r’) I have a tempral data series, which I need to integrate. In order to understand how Matlab does that, I start with a parabola as the data series. Could you guys please explain me why I get completely different results using the integral and cumtrapz funtions? The cumtrapz is giving me a cubic function, but I have no idea why it is only positive and I also do not understand the limits. My understanding is that the answer should be simple: intfx = x^3/3…
x = [-10:0.01:10]’;
fx = x.^2;
% intfx = integral(@(x) fx, x(1), x(end), ‘ArrayValued’, true);
intfx = cumtrapz(fx,x);
plot(x,fx,’b’)
hold on
plot(x,intfx,’r’) integral, cumtrapz MATLAB Answers — New Questions
dispersion equation in water waves
I am solving dispersion equation for water waves. I already solved it but with small h now i am using the same code but having different h and it give me incorrect evenscent modes. How i can fix my this code that it works well. Below is my code
clc;
close all;
clear all;
N = 10; % Terms number used in region I
% — 2. Dimensional geometry & environment ———————
RI = 34.5; % [m] inner / entrance radius (fully open ⇒ RI = RT)
RE = 47.5; % [m] outer hull radius (used for k0*RE axis)
d = 38.0; % [m] draft = free-surface → rim (water-column length)
h = 200; % [m] total water depth (free-surface → seabed)
b = h – d; % [m] clearance rim → seabed (= 162 m, not usually used)
g=9.81;
k0RE = linspace(5, 35, 200); % 200 points, dimension-less
I_given_wavenumber = 1;
% ————— ① pre-allocate
for j = 1:length(k0RE)
if I_given_wavenumber == 1
wk = k0RE(j)/RE; %wavenumber
omega = sqrt(g*wk*tanh(wk*h)); %wave radian frequency
fun_alpha = @(x) omega^2 + g*x*tan(x*h); %dispersion equation for evanescent modes
end
for n = 1:N
if n ==1
k(n) = -1i*wk;
else
x0_alpha = [(2*n -3)*pi/2./h, (2*n -1)*pi/2./h]; % Narrow interval
k(n) = fsolve(fun_alpha, mean(x0_alpha));
end
end
endI am solving dispersion equation for water waves. I already solved it but with small h now i am using the same code but having different h and it give me incorrect evenscent modes. How i can fix my this code that it works well. Below is my code
clc;
close all;
clear all;
N = 10; % Terms number used in region I
% — 2. Dimensional geometry & environment ———————
RI = 34.5; % [m] inner / entrance radius (fully open ⇒ RI = RT)
RE = 47.5; % [m] outer hull radius (used for k0*RE axis)
d = 38.0; % [m] draft = free-surface → rim (water-column length)
h = 200; % [m] total water depth (free-surface → seabed)
b = h – d; % [m] clearance rim → seabed (= 162 m, not usually used)
g=9.81;
k0RE = linspace(5, 35, 200); % 200 points, dimension-less
I_given_wavenumber = 1;
% ————— ① pre-allocate
for j = 1:length(k0RE)
if I_given_wavenumber == 1
wk = k0RE(j)/RE; %wavenumber
omega = sqrt(g*wk*tanh(wk*h)); %wave radian frequency
fun_alpha = @(x) omega^2 + g*x*tan(x*h); %dispersion equation for evanescent modes
end
for n = 1:N
if n ==1
k(n) = -1i*wk;
else
x0_alpha = [(2*n -3)*pi/2./h, (2*n -1)*pi/2./h]; % Narrow interval
k(n) = fsolve(fun_alpha, mean(x0_alpha));
end
end
end I am solving dispersion equation for water waves. I already solved it but with small h now i am using the same code but having different h and it give me incorrect evenscent modes. How i can fix my this code that it works well. Below is my code
clc;
close all;
clear all;
N = 10; % Terms number used in region I
% — 2. Dimensional geometry & environment ———————
RI = 34.5; % [m] inner / entrance radius (fully open ⇒ RI = RT)
RE = 47.5; % [m] outer hull radius (used for k0*RE axis)
d = 38.0; % [m] draft = free-surface → rim (water-column length)
h = 200; % [m] total water depth (free-surface → seabed)
b = h – d; % [m] clearance rim → seabed (= 162 m, not usually used)
g=9.81;
k0RE = linspace(5, 35, 200); % 200 points, dimension-less
I_given_wavenumber = 1;
% ————— ① pre-allocate
for j = 1:length(k0RE)
if I_given_wavenumber == 1
wk = k0RE(j)/RE; %wavenumber
omega = sqrt(g*wk*tanh(wk*h)); %wave radian frequency
fun_alpha = @(x) omega^2 + g*x*tan(x*h); %dispersion equation for evanescent modes
end
for n = 1:N
if n ==1
k(n) = -1i*wk;
else
x0_alpha = [(2*n -3)*pi/2./h, (2*n -1)*pi/2./h]; % Narrow interval
k(n) = fsolve(fun_alpha, mean(x0_alpha));
end
end
end evenscent modes, dispersion equation, water waves MATLAB Answers — New Questions
unpause from a uifigure
I’m used to using pause to run through a loop with plots and to pause until hitting return. Something like this:
for i = 1:100
plot(1:i)
pause
end
(Edit: to clarify, this is pressing return while focuse on the figure window)
Now however if the code launches a uifigure, it is unclear how to run the same code. Is there a way of programatically unpausing?
fig = uifigure;
ax = axes(fig)
for i = 1:100
plot(ax,1:i)
pause
end
I know I can use uiwait and uiresume but it is unclear why I can’t get code to work that supports pause as well.I’m used to using pause to run through a loop with plots and to pause until hitting return. Something like this:
for i = 1:100
plot(1:i)
pause
end
(Edit: to clarify, this is pressing return while focuse on the figure window)
Now however if the code launches a uifigure, it is unclear how to run the same code. Is there a way of programatically unpausing?
fig = uifigure;
ax = axes(fig)
for i = 1:100
plot(ax,1:i)
pause
end
I know I can use uiwait and uiresume but it is unclear why I can’t get code to work that supports pause as well. I’m used to using pause to run through a loop with plots and to pause until hitting return. Something like this:
for i = 1:100
plot(1:i)
pause
end
(Edit: to clarify, this is pressing return while focuse on the figure window)
Now however if the code launches a uifigure, it is unclear how to run the same code. Is there a way of programatically unpausing?
fig = uifigure;
ax = axes(fig)
for i = 1:100
plot(ax,1:i)
pause
end
I know I can use uiwait and uiresume but it is unclear why I can’t get code to work that supports pause as well. matlab, pause MATLAB Answers — New Questions
Stateflow Onramp Task 4: Transition from Off to On marked incorrect despite matching solution
I’m working on Stateflow Onramp > Creating State Charts > Default Transitions and Unreachable States (Task 4). The task asks to:
Add a transition from Off to On.
I added the transition exactly as shown in the solution — from the edge of the Off state to the edge of the On state. The chart visually matches the solution, and there’s a default transition to Off.
However, after clicking Submit, I still get the message:
Sorry, that answer is incorrect. Please review the requirements on the right side.
There are no conditions or events on the transition (as per the example), and both states are reachable, as both get highlighted during the run.
What could I be missing? Is there a hidden requirement not shown in the visual solution?
Thanks in advance!I’m working on Stateflow Onramp > Creating State Charts > Default Transitions and Unreachable States (Task 4). The task asks to:
Add a transition from Off to On.
I added the transition exactly as shown in the solution — from the edge of the Off state to the edge of the On state. The chart visually matches the solution, and there’s a default transition to Off.
However, after clicking Submit, I still get the message:
Sorry, that answer is incorrect. Please review the requirements on the right side.
There are no conditions or events on the transition (as per the example), and both states are reachable, as both get highlighted during the run.
What could I be missing? Is there a hidden requirement not shown in the visual solution?
Thanks in advance! I’m working on Stateflow Onramp > Creating State Charts > Default Transitions and Unreachable States (Task 4). The task asks to:
Add a transition from Off to On.
I added the transition exactly as shown in the solution — from the edge of the Off state to the edge of the On state. The chart visually matches the solution, and there’s a default transition to Off.
However, after clicking Submit, I still get the message:
Sorry, that answer is incorrect. Please review the requirements on the right side.
There are no conditions or events on the transition (as per the example), and both states are reachable, as both get highlighted during the run.
What could I be missing? Is there a hidden requirement not shown in the visual solution?
Thanks in advance! stateflow onramp, stateflow, matlab, simulink MATLAB Answers — New Questions
Drawnow for a single element (uilabel)
I’m trying to add a ‘status’ value to my MATLAB app, and have placed a uilabel to populate via a parallel.pool.DataQueue (with afterEach).
Unfortunately, it doesn’t refresh unless the UI completes an update, e.g. triggered by something like ‘drawnow’.
Other parts of my application have graphs that I’d rather not have replot at the same time – my main use of the status label will be to indicate that files are being loaded (often in the background, using parfeval), but if the data for the graphs is being loaded, I’d rather see the old/previous graphs until the next ones are ready.
Can I either exclude graphs from a drawnow command, or specify which ui elements I want to refresh?
If not, is there a sensible workaround here? (I can vaguely imagine tracking two sets of graphs, and not updating the data on the graph (or rather, the data being queried to place on the graph) until after the loading completes, but this seems likely to waste effort redrawing large numbers of points just to update a label, and also to be quite a bit harder to read…)
The uiprogressdlg seems to be modal – if I can make it embed in a uipanel or at least not block the uifigure, it would be a possibility, but mainly I’d like to update the status text whilst interacting with existing data on the graphs without really having to pay attention to the status text (a uiprogressdlg seems to act quite differently to that).I’m trying to add a ‘status’ value to my MATLAB app, and have placed a uilabel to populate via a parallel.pool.DataQueue (with afterEach).
Unfortunately, it doesn’t refresh unless the UI completes an update, e.g. triggered by something like ‘drawnow’.
Other parts of my application have graphs that I’d rather not have replot at the same time – my main use of the status label will be to indicate that files are being loaded (often in the background, using parfeval), but if the data for the graphs is being loaded, I’d rather see the old/previous graphs until the next ones are ready.
Can I either exclude graphs from a drawnow command, or specify which ui elements I want to refresh?
If not, is there a sensible workaround here? (I can vaguely imagine tracking two sets of graphs, and not updating the data on the graph (or rather, the data being queried to place on the graph) until after the loading completes, but this seems likely to waste effort redrawing large numbers of points just to update a label, and also to be quite a bit harder to read…)
The uiprogressdlg seems to be modal – if I can make it embed in a uipanel or at least not block the uifigure, it would be a possibility, but mainly I’d like to update the status text whilst interacting with existing data on the graphs without really having to pay attention to the status text (a uiprogressdlg seems to act quite differently to that). I’m trying to add a ‘status’ value to my MATLAB app, and have placed a uilabel to populate via a parallel.pool.DataQueue (with afterEach).
Unfortunately, it doesn’t refresh unless the UI completes an update, e.g. triggered by something like ‘drawnow’.
Other parts of my application have graphs that I’d rather not have replot at the same time – my main use of the status label will be to indicate that files are being loaded (often in the background, using parfeval), but if the data for the graphs is being loaded, I’d rather see the old/previous graphs until the next ones are ready.
Can I either exclude graphs from a drawnow command, or specify which ui elements I want to refresh?
If not, is there a sensible workaround here? (I can vaguely imagine tracking two sets of graphs, and not updating the data on the graph (or rather, the data being queried to place on the graph) until after the loading completes, but this seems likely to waste effort redrawing large numbers of points just to update a label, and also to be quite a bit harder to read…)
The uiprogressdlg seems to be modal – if I can make it embed in a uipanel or at least not block the uifigure, it would be a possibility, but mainly I’d like to update the status text whilst interacting with existing data on the graphs without really having to pay attention to the status text (a uiprogressdlg seems to act quite differently to that). matlab gui, drawnow MATLAB Answers — New Questions
Problem with comments in XML files
I have an m-file that reads an XML file to get inputs. I’m running into a problem with comments in the XML file. Simply put, if I put a comment inside the tag but before the value, then I get an empty string for the value. Comments elsewhere don’t cause problems
Here’s a toy example of my m-file:
function userInputStruct = readToyXmlInput()
toyXmlInputFile = ‘toyXmlInput.xml’;
xDoc = xmlread(toyXmlInputFile);
userInput = xDoc.getElementsByTagName(‘userInput’);
userInputStruct = struct(); % Initialize
thisUserInput = userInput.item(0);
thisInput_01 = thisUserInput.getElementsByTagName(‘input_01’);
thisInput_01Element = thisInput_01.item(0);
temp01 = thisInput_01Element.getFirstChild.getData;
temp02 = string(temp01);
input_01 = strip(temp02);
userInputStruct.input_01 = input_01;
Here’s a toy example of my XML file:
<toyXmlInput>
<userInput>
<!– A comment here is fine. –>
<input_01>
Dummy input #1 <!– A comment here is fine. –>
<!– A comment here is fine. –>
</input_01>
</userInput>
</toyXmlInput>
Here’s a toy example of my XML file with a comment that causes a problem.
<toyXmlInput>
<userInput>
<input_01>
<!– A comment here causes problems –>
Dummy input #1
</input_01>
</userInput>
</toyXmlInput>
What am I doing wrong? What can I do differently so that comments after the tag but before the value don’t cause problems?
Worst-case, I’ll just document in the m-file and the XML file that there’s a limit on where comments can go. However, I’d prefer a more elegant solution.I have an m-file that reads an XML file to get inputs. I’m running into a problem with comments in the XML file. Simply put, if I put a comment inside the tag but before the value, then I get an empty string for the value. Comments elsewhere don’t cause problems
Here’s a toy example of my m-file:
function userInputStruct = readToyXmlInput()
toyXmlInputFile = ‘toyXmlInput.xml’;
xDoc = xmlread(toyXmlInputFile);
userInput = xDoc.getElementsByTagName(‘userInput’);
userInputStruct = struct(); % Initialize
thisUserInput = userInput.item(0);
thisInput_01 = thisUserInput.getElementsByTagName(‘input_01’);
thisInput_01Element = thisInput_01.item(0);
temp01 = thisInput_01Element.getFirstChild.getData;
temp02 = string(temp01);
input_01 = strip(temp02);
userInputStruct.input_01 = input_01;
Here’s a toy example of my XML file:
<toyXmlInput>
<userInput>
<!– A comment here is fine. –>
<input_01>
Dummy input #1 <!– A comment here is fine. –>
<!– A comment here is fine. –>
</input_01>
</userInput>
</toyXmlInput>
Here’s a toy example of my XML file with a comment that causes a problem.
<toyXmlInput>
<userInput>
<input_01>
<!– A comment here causes problems –>
Dummy input #1
</input_01>
</userInput>
</toyXmlInput>
What am I doing wrong? What can I do differently so that comments after the tag but before the value don’t cause problems?
Worst-case, I’ll just document in the m-file and the XML file that there’s a limit on where comments can go. However, I’d prefer a more elegant solution. I have an m-file that reads an XML file to get inputs. I’m running into a problem with comments in the XML file. Simply put, if I put a comment inside the tag but before the value, then I get an empty string for the value. Comments elsewhere don’t cause problems
Here’s a toy example of my m-file:
function userInputStruct = readToyXmlInput()
toyXmlInputFile = ‘toyXmlInput.xml’;
xDoc = xmlread(toyXmlInputFile);
userInput = xDoc.getElementsByTagName(‘userInput’);
userInputStruct = struct(); % Initialize
thisUserInput = userInput.item(0);
thisInput_01 = thisUserInput.getElementsByTagName(‘input_01’);
thisInput_01Element = thisInput_01.item(0);
temp01 = thisInput_01Element.getFirstChild.getData;
temp02 = string(temp01);
input_01 = strip(temp02);
userInputStruct.input_01 = input_01;
Here’s a toy example of my XML file:
<toyXmlInput>
<userInput>
<!– A comment here is fine. –>
<input_01>
Dummy input #1 <!– A comment here is fine. –>
<!– A comment here is fine. –>
</input_01>
</userInput>
</toyXmlInput>
Here’s a toy example of my XML file with a comment that causes a problem.
<toyXmlInput>
<userInput>
<input_01>
<!– A comment here causes problems –>
Dummy input #1
</input_01>
</userInput>
</toyXmlInput>
What am I doing wrong? What can I do differently so that comments after the tag but before the value don’t cause problems?
Worst-case, I’ll just document in the m-file and the XML file that there’s a limit on where comments can go. However, I’d prefer a more elegant solution. xml, comment MATLAB Answers — New Questions
Recommitting to our why, what, and how
Satya Nadella, Chairman and CEO, shared the below communication with Microsoft employees this morning.
As we begin a new fiscal year, I’ve been reflecting on the road we’ve traveled together and the path ahead.
Before anything else, I want to speak to what’s been weighing heavily on me, and what I know many of you are thinking about: the recent job eliminations. These decisions are among the most difficult we have to make. They affect people we’ve worked alongside, learned from, and shared countless moments with—our colleagues, teammates, and friends.
I want to express my sincere gratitude to those who have left. Their contributions have shaped who we are as a company, helping build the foundation we stand on today. And for that, I am deeply grateful.
I also want to acknowledge the uncertainty and seeming incongruence of the times we’re in. By every objective measure, Microsoft is thriving—our market performance, strategic positioning, and growth all point up and to the right. We’re investing more in CapEx than ever before. Our overall headcount is relatively unchanged, and some of the talent and expertise in our industry and at Microsoft is being recognized and rewarded at levels never seen before. And yet, at the same time, we’ve undergone layoffs.
This is the enigma of success in an industry that has no franchise value. Progress isn’t linear. It’s dynamic, sometimes dissonant, and always demanding. But it’s also a new opportunity for us to shape, lead through, and have greater impact than ever before.
The success we want to achieve will be defined by our ability to go through this difficult process of “unlearning” and “learning.” It requires us to meet changing customer needs, by continuing to maintain and scale our current business, while also creating new categories with new business models and a new production function. This is inherently hard, and few companies can do both.
But I have full confidence that we can, and we will once again find the resolve, courage, and clarity to deliver on our mission in this new paradigm.
With that context, I want to re-ground ourselves in our why, what, and how: our mission, our priorities, and our culture.
Our why: mission
What does achieving our mission look like and feel like for us as a company? When Microsoft is succeeding, the world around us must succeed too. This is why each of us chose to be here, and as a company it’s how we earn our social permission to operate. When Bill founded Microsoft, he envisioned not just a software company, but a software factory, unconstrained by any single product or category. That idea has guided us for decades. But today, it’s no longer enough.
We must reimagine our mission for a new era. What does empowerment look like in the era of AI? It’s not just about building tools for specific roles or tasks. It’s about building tools that empower everyone to create their own tools. That’s the shift we are driving—from a software factory to an intelligence engine empowering every person and organization to build whatever they need to achieve.
Just imagine if all 8 billion people could summon a researcher, an analyst, or a coding agent at their fingertips, not just to get information but use their expertise to get things done that benefit them. And consider how organizations, empowered with AI, could unlock entirely new levels of agility and innovation by transforming decision-making, streamlining operations, and enabling every team to achieve more together than ever before.
That’s the empowerment our mission enables, creating local surplus in every company, community, and country. And that’s our opportunity ahead.
Our what: priorities
To deliver on our mission, we need to stay focused on our three business priorities: security, quality, and AI transformation.
We are doubling down on the fundamentals while continuing to define new frontiers in AI.
Security and quality are non-negotiable. Our infrastructure and services are mission critical for the world, and without them we don’t have permission to move forward.
We’ve made substantial progress across SFI, QEI, and Engineering Thrive this year, and they remain top priorities to ensure that we continuously improve our innovation velocity and our operational metrics.
We will reimagine every layer of the tech stack for AI—infrastructure, to the app platform, to apps and agents. The key is to get the platform primitives right for these new workloads and for the next order of magnitude of scale. Our differentiation will come from how we bring these layers together to deliver end-to-end experiences and products, with the core ethos of a platform company that fosters ecosystem opportunity broadly. Getting both the product and platform right for the AI wave is our North Star!
Our performance this past year has positioned us well. And we must move forward with the intentionality and intensity that these industry shifts demand.
Our how: culture
Growth mindset has served us well over the last decade—the everyday practice of being a learn-it-all, not a know-it-all. It has reshaped our culture and helped us lead with greater humility and empathy. We need to keep that.
It starts with each of us as individuals and our personal drive to learn, improve, and get better every day. Professional rewards, growth, and pride in our craft will always be the prime drivers. Beyond that, we each have the opportunity to connect our personal passion and philosophy of how we derive meaning from the work we do with Microsoft’s mission to empower the world. This is what makes it all worthwhile.
This platform shift is reshaping not only the products we build and the business models we operate under, but also how we are structured and how we work together every day. It might feel messy at times, but transformation always is. Teams are reorganizing. Scopes are expanding. New opportunities are everywhere. It reminds me of the early ’90s, when PCs and productivity software became standard in every home and every desk! That’s exactly where we are now with AI.
Years from now, when you look back at your time here, I hope you’ll say: “That’s when I learned the most. That’s when I made my biggest impact. That’s when I was part of something transformational.”
What we’ve learned over the past five decades is that success is not about longevity. It’s about relevance. Our future won’t be defined by what we’ve built before, but by what we empower others to build now.
And I know that with your dedication, drive, and hard work we can go win together, and change the world in the process.
I look forward to sharing more at Earnings next week and addressing your questions at our next Town Hall.
Satya
The post Recommitting to our why, what, and how appeared first on The Official Microsoft Blog.
Satya Nadella, Chairman and CEO, shared the below communication with Microsoft employees this morning. As we begin a new fiscal year, I’ve been reflecting on the road we’ve traveled together and the path ahead. Before anything else, I want to speak to what’s been weighing heavily on me, and what I know many of you…
The post Recommitting to our why, what, and how appeared first on The Official Microsoft Blog.Read More
Autocoder settings to get variables declared in *_mr_private.h file vs in *_mr_data.cpp.
I am upgrading a simulink/embedded coder project from R2020b to R2024b. Having successfully generated code in the new version, we examined some differences in the generated code files. Some data "myVar" is being duplicated in a *_mr_data.cpp file for a model reference "myModel", that is already declared in shared location const_params.cpp.
The data in the image displayed below for reference….
2020b example
myVar is a simulink parameter in a constant block in the toplevel model myModel.
when generating code we get the relevant lines
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
(other vars, myVar not included)}
myModel_mr_private.h:
(no include)
extern myVar_bstruct *myVar; // Variable: myVar
myModel_mr_data.cpp:
#include "myModel_mr.h"
#include "myModel_mr_private.h"
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: anotherVar (myVar not in file)
// Referenced by:
….
{ lots of data }
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
typedef struct { other structs that make up myVar } myVar_bstruct;
2024b example
same setup with myVar and myModel
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
myVar_bstruct myVar; (and other vars)}
myModel_mr_private.h:
#include "myModel_mr_types.h"
No listing
myModel_mr_data.cpp:
#include "myModel_mr.h"
(no mr_private.h include)
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: myVar
// Referenced by:
….
{ duplicate myVar data (is also in const_params.cpp) and other vars}
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
struct myVar_bstruct { other structs that make up myVar };
end example.
As you can see above there is a little bit of a difference of how the myVar data is getting declared in the autocode. The 2024b version is causing the myModel_mr_data.cpp file to go from 300k to 3MB with the duplicated data. (this may be small for some but its important in this use case)
Some of the settings i’ve already tried on the configuration of the model.
set_param(‘myModel’, ‘CodeInterfacePackaging’, ‘Nonreusable function’)
set_param(‘myModel’, ‘ParameterStorageClass’, ‘Model default’);
Was attempting this and matlab went poof, after the Headerfile field wasn’t avail.
myVar.CoderInfo.StorageClass = ‘Custom’;
myVar.CoderInfo.CustomAttributes.HeaderFile = ‘myModel_mr_private.h’;
Anyinsight would be greatly appreciated…I am upgrading a simulink/embedded coder project from R2020b to R2024b. Having successfully generated code in the new version, we examined some differences in the generated code files. Some data "myVar" is being duplicated in a *_mr_data.cpp file for a model reference "myModel", that is already declared in shared location const_params.cpp.
The data in the image displayed below for reference….
2020b example
myVar is a simulink parameter in a constant block in the toplevel model myModel.
when generating code we get the relevant lines
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
(other vars, myVar not included)}
myModel_mr_private.h:
(no include)
extern myVar_bstruct *myVar; // Variable: myVar
myModel_mr_data.cpp:
#include "myModel_mr.h"
#include "myModel_mr_private.h"
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: anotherVar (myVar not in file)
// Referenced by:
….
{ lots of data }
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
typedef struct { other structs that make up myVar } myVar_bstruct;
2024b example
same setup with myVar and myModel
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
myVar_bstruct myVar; (and other vars)}
myModel_mr_private.h:
#include "myModel_mr_types.h"
No listing
myModel_mr_data.cpp:
#include "myModel_mr.h"
(no mr_private.h include)
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: myVar
// Referenced by:
….
{ duplicate myVar data (is also in const_params.cpp) and other vars}
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
struct myVar_bstruct { other structs that make up myVar };
end example.
As you can see above there is a little bit of a difference of how the myVar data is getting declared in the autocode. The 2024b version is causing the myModel_mr_data.cpp file to go from 300k to 3MB with the duplicated data. (this may be small for some but its important in this use case)
Some of the settings i’ve already tried on the configuration of the model.
set_param(‘myModel’, ‘CodeInterfacePackaging’, ‘Nonreusable function’)
set_param(‘myModel’, ‘ParameterStorageClass’, ‘Model default’);
Was attempting this and matlab went poof, after the Headerfile field wasn’t avail.
myVar.CoderInfo.StorageClass = ‘Custom’;
myVar.CoderInfo.CustomAttributes.HeaderFile = ‘myModel_mr_private.h’;
Anyinsight would be greatly appreciated… I am upgrading a simulink/embedded coder project from R2020b to R2024b. Having successfully generated code in the new version, we examined some differences in the generated code files. Some data "myVar" is being duplicated in a *_mr_data.cpp file for a model reference "myModel", that is already declared in shared location const_params.cpp.
The data in the image displayed below for reference….
2020b example
myVar is a simulink parameter in a constant block in the toplevel model myModel.
when generating code we get the relevant lines
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
(other vars, myVar not included)}
myModel_mr_private.h:
(no include)
extern myVar_bstruct *myVar; // Variable: myVar
myModel_mr_data.cpp:
#include "myModel_mr.h"
#include "myModel_mr_private.h"
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: anotherVar (myVar not in file)
// Referenced by:
….
{ lots of data }
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
typedef struct { other structs that make up myVar } myVar_bstruct;
2024b example
same setup with myVar and myModel
myModel_mr.h:
// Parameters (default storage)
struct P_myModel_mr_T_ {
myVar_bstruct myVar; (and other vars)}
myModel_mr_private.h:
#include "myModel_mr_types.h"
No listing
myModel_mr_data.cpp:
#include "myModel_mr.h"
(no mr_private.h include)
// Block parameters (default storage)
P_myModel_mr_T myModel_mr_P{
// Variable: myVar
// Referenced by:
….
{ duplicate myVar data (is also in const_params.cpp) and other vars}
slprj/ert/_sharedutils/const_params.cpp:
extern const myVar_bstruct rtCP_pooled_(mangled);
const myVar_bstruct rtCP_pooled_(mangled) = {all the data (its alot)}
slprj/ert/_sharedutils/my_shared_bus.h:
// Simulink Bus: myVar_bstruct
struct myVar_bstruct { other structs that make up myVar };
end example.
As you can see above there is a little bit of a difference of how the myVar data is getting declared in the autocode. The 2024b version is causing the myModel_mr_data.cpp file to go from 300k to 3MB with the duplicated data. (this may be small for some but its important in this use case)
Some of the settings i’ve already tried on the configuration of the model.
set_param(‘myModel’, ‘CodeInterfacePackaging’, ‘Nonreusable function’)
set_param(‘myModel’, ‘ParameterStorageClass’, ‘Model default’);
Was attempting this and matlab went poof, after the Headerfile field wasn’t avail.
myVar.CoderInfo.StorageClass = ‘Custom’;
myVar.CoderInfo.CustomAttributes.HeaderFile = ‘myModel_mr_private.h’;
Anyinsight would be greatly appreciated… autocode, embedded coder, code generation, simulink coder MATLAB Answers — New Questions
Bus with sub buses with wrong type (bug ?)
Hello everyone!
Settings
I am facing a very strange issue. Here is my situation : I am creating a Simulink model that call a complex Matlab function. The function, name MD, is take a nested struct as an input, named config. The struct will be updated meaning adding fields (only on the first call), and updated value.
After some research, I have understood that the best way to solve my problem is to create a type ‘bus :configbus’, via
Simulink.Bus.createObject(config)
evalin(‘base’, ‘configbus = slBus1;’);
clear("slBus1")
Then, in Simulink I have my Matlab function block, linked to Data Store Read / write for interfacing the config input. This is for the setup.
Adding fields
To solve the fact that on the first call I am adding fields, I run once the function MD, before the simulation and creating the bus, to get all the correct field. I am open to better solution that this bit if you have any.
Errors encounter
However, when configuring the Data Store Memory with the Initial value I get the following error (error1):
Invalid setting in ‘path to Data Store Read’ for parameter ‘InitialValue’.
I am trying the following combination:
Inital Value : config
type : Bus:configBus.
(my function as the input define as the correct type and there is no issue there)
When I run my model I get the error (error2):
Error using Leia_main (line 47)
Expression ‘configBus’ for type of data ‘config’ did not evaluate to a valid type.
Caused by:
Error using Leia_main (line 47)
Invalid setting in ‘Guidance/If Action Subsystem2/If Action Subsystem1/New Planing/MATLAB Function’ for parameter ‘Datatype’
Error using Leia_main (line 47)
Error evaluating MATLAB Function parameter data
‘Datatype’ in its parent workspace.
Error using Leia_main (line 47)
Unrecognized function or variable ‘configBus’.
Error using Leia_main (line 47)
Variable ‘configBus’ does not exist.
Suggested Actions:
• Load a file into base workspace. – Fix
• Create a new variable. – Fix
Which is really wierd, since it seems that Matlab is confusing the type and the variable. But I have checked and everything seems to be declare as it should.
My investigation
When I look at my top bus definition it do not seems that field corresponding to subbuses are mapped properly. Even though the correct bus type exist.
Here is an example :
SK_requirement is supposed to be of type bus: SK_requirement but is of type SK_requirement which I don’t know what type it points to.
And if I set it correctly I get :
Is there any reason why this is behaving like this ? I would expect that the configbus declartion to be correctly typed. (I will try to manually set the good type and see if there is any improvement). My naive guess is that it might solve error1, but not sure.
Questions
1) Is there a better way to create the top level bus ? Or is it just a bug ?
2) Do you have any idea for error1 ?
3) Do you have any idea for solutioning error2 ?
Information
Runing matlab25a without the last update. Using MacOS with Apple chip.
Thank you in advance for your insights.Hello everyone!
Settings
I am facing a very strange issue. Here is my situation : I am creating a Simulink model that call a complex Matlab function. The function, name MD, is take a nested struct as an input, named config. The struct will be updated meaning adding fields (only on the first call), and updated value.
After some research, I have understood that the best way to solve my problem is to create a type ‘bus :configbus’, via
Simulink.Bus.createObject(config)
evalin(‘base’, ‘configbus = slBus1;’);
clear("slBus1")
Then, in Simulink I have my Matlab function block, linked to Data Store Read / write for interfacing the config input. This is for the setup.
Adding fields
To solve the fact that on the first call I am adding fields, I run once the function MD, before the simulation and creating the bus, to get all the correct field. I am open to better solution that this bit if you have any.
Errors encounter
However, when configuring the Data Store Memory with the Initial value I get the following error (error1):
Invalid setting in ‘path to Data Store Read’ for parameter ‘InitialValue’.
I am trying the following combination:
Inital Value : config
type : Bus:configBus.
(my function as the input define as the correct type and there is no issue there)
When I run my model I get the error (error2):
Error using Leia_main (line 47)
Expression ‘configBus’ for type of data ‘config’ did not evaluate to a valid type.
Caused by:
Error using Leia_main (line 47)
Invalid setting in ‘Guidance/If Action Subsystem2/If Action Subsystem1/New Planing/MATLAB Function’ for parameter ‘Datatype’
Error using Leia_main (line 47)
Error evaluating MATLAB Function parameter data
‘Datatype’ in its parent workspace.
Error using Leia_main (line 47)
Unrecognized function or variable ‘configBus’.
Error using Leia_main (line 47)
Variable ‘configBus’ does not exist.
Suggested Actions:
• Load a file into base workspace. – Fix
• Create a new variable. – Fix
Which is really wierd, since it seems that Matlab is confusing the type and the variable. But I have checked and everything seems to be declare as it should.
My investigation
When I look at my top bus definition it do not seems that field corresponding to subbuses are mapped properly. Even though the correct bus type exist.
Here is an example :
SK_requirement is supposed to be of type bus: SK_requirement but is of type SK_requirement which I don’t know what type it points to.
And if I set it correctly I get :
Is there any reason why this is behaving like this ? I would expect that the configbus declartion to be correctly typed. (I will try to manually set the good type and see if there is any improvement). My naive guess is that it might solve error1, but not sure.
Questions
1) Is there a better way to create the top level bus ? Or is it just a bug ?
2) Do you have any idea for error1 ?
3) Do you have any idea for solutioning error2 ?
Information
Runing matlab25a without the last update. Using MacOS with Apple chip.
Thank you in advance for your insights. Hello everyone!
Settings
I am facing a very strange issue. Here is my situation : I am creating a Simulink model that call a complex Matlab function. The function, name MD, is take a nested struct as an input, named config. The struct will be updated meaning adding fields (only on the first call), and updated value.
After some research, I have understood that the best way to solve my problem is to create a type ‘bus :configbus’, via
Simulink.Bus.createObject(config)
evalin(‘base’, ‘configbus = slBus1;’);
clear("slBus1")
Then, in Simulink I have my Matlab function block, linked to Data Store Read / write for interfacing the config input. This is for the setup.
Adding fields
To solve the fact that on the first call I am adding fields, I run once the function MD, before the simulation and creating the bus, to get all the correct field. I am open to better solution that this bit if you have any.
Errors encounter
However, when configuring the Data Store Memory with the Initial value I get the following error (error1):
Invalid setting in ‘path to Data Store Read’ for parameter ‘InitialValue’.
I am trying the following combination:
Inital Value : config
type : Bus:configBus.
(my function as the input define as the correct type and there is no issue there)
When I run my model I get the error (error2):
Error using Leia_main (line 47)
Expression ‘configBus’ for type of data ‘config’ did not evaluate to a valid type.
Caused by:
Error using Leia_main (line 47)
Invalid setting in ‘Guidance/If Action Subsystem2/If Action Subsystem1/New Planing/MATLAB Function’ for parameter ‘Datatype’
Error using Leia_main (line 47)
Error evaluating MATLAB Function parameter data
‘Datatype’ in its parent workspace.
Error using Leia_main (line 47)
Unrecognized function or variable ‘configBus’.
Error using Leia_main (line 47)
Variable ‘configBus’ does not exist.
Suggested Actions:
• Load a file into base workspace. – Fix
• Create a new variable. – Fix
Which is really wierd, since it seems that Matlab is confusing the type and the variable. But I have checked and everything seems to be declare as it should.
My investigation
When I look at my top bus definition it do not seems that field corresponding to subbuses are mapped properly. Even though the correct bus type exist.
Here is an example :
SK_requirement is supposed to be of type bus: SK_requirement but is of type SK_requirement which I don’t know what type it points to.
And if I set it correctly I get :
Is there any reason why this is behaving like this ? I would expect that the configbus declartion to be correctly typed. (I will try to manually set the good type and see if there is any improvement). My naive guess is that it might solve error1, but not sure.
Questions
1) Is there a better way to create the top level bus ? Or is it just a bug ?
2) Do you have any idea for error1 ?
3) Do you have any idea for solutioning error2 ?
Information
Runing matlab25a without the last update. Using MacOS with Apple chip.
Thank you in advance for your insights. simulink, bus, sub-bus, type, datastorememory, matlab function MATLAB Answers — New Questions
Gaps in contour plot using custom secant method (when solving for two-plume merger)
Hello all,
I’m working on a MATLAB script that computes the merging contour between two turbulent plumes, using a custom root-finding function called mnhf_secant. This function implements a supervisor-provided secant method to solve a nonlinear equation that describes the interface between the plumes. The governing equation being solved is located at the bottom of the code and is derived from plume interaction theory.
The issue arises in the else branch of the loop that iterates over polar angles (θ). When the code enters this branch, the contour plot generated shows visible gaps between the red line (plume boundary) and the black line (reference contour), indicating that the solution is not continuous or fails to resolve in those regions.
This breakdown does not occur in the first half of the angular domain (handled by the if condition), where the contours are computed correctly as seen by the continuous black line. The discontinuity seems localized to the else loop, despite using the same root-finding logic.I tried different guesses for the secant function but is not helping to solve for the gaps.
My main question is:
Is there a modification I could implement in the else branch to ensure a continuous contour across the full angular domain? I have attached the code below.
close all; clc; clf
global r0 k theta
%% Parameter input, plume source of finite size
r0 = 1/3;
k_array = [0.3 0.5 0.7 1-r0^2 1]
Nt = 20001; % Must be odd for symmetry
theta_array = linspace(-pi/2, pi/2, Nt);
figure(1); hold on; box on
for jj = 1:length(k_array)
k = k_array(jj);
if k >= 1 – r0^2
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
else
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
% Identify breakdown angle where rho fails
ij = find(isnan(rho_array1(1:round(end/2))));
if ~isempty(ij)
theta_min = theta_array(max(ij)) % closest valid angle before breakdown
theta_array2 = linspace(theta_min, -theta_min, Nt); % symmetric gap domain
rho_array2 = zeros(1, length(theta_array2));
% Solve numerically in gap region
for ii = 1:length(theta_array2)
theta = theta_array2(ii);
rho_array2(ii) = mnhf_secant(@TwoPlumes_Equation, [0.1 0.4], 1e-6, 0);
if rho_array2(ii)<0
rho_array2(ii) = NaN;
end
end
[x2, y2] = pol2cart(theta_array2, rho_array2);
plot(x2, y2, ‘r.’); axis square; xlim([0 2]); ylim([-1 1]);
end
end
pos1 = [1 – r0, -r0, 2*r0, 2*r0];
rectangle(‘Position’, pos1, ‘Curvature’, [1 1], ‘FaceColor’, [0 0 0]);
end
function r=mnhf_secant(Fun,x,tol,trace)
%MNHF_SECANT finds the root of "Fun" using secant scheme.
%
% Fun – name of the external function
% x – vector of length 2, (initial guesses)
% tol – tolerance
% trace – print intermediate results
%
% Usage mnhf_secant(@poly1,[-0.5 2.0],1e-8,1)
% poly1 is the name of the external function.
% [-0.5 2.0] are the initial guesses for the root.
% Check inputs.
if nargin < 4, trace = 1; end
if nargin < 3, tol = 1e-8; end
if (length(x) ~= 2)
error(‘Please provide two initial guesses’)
end
f = feval(Fun,x); % Fun is assumed to accept a vector
for i = 1:100
x3 = x(1)-f(1)*(x(2)-x(1))/(f(2)-f(1)); % Update the guess.
f3 = feval(Fun,x3); % Function evaluation.
if trace, fprintf(1,’%3i %12.5f %12.5fn’, i,x3,f3); end
if abs(f3) < tol % Check for convergenece.
r = x3;
return
else % Reset values for x(1), x(2), f(1) and f(2).
x(1) = x(2); f(1) = f(2); x(2) = x3; f(2) = f3;
end
end
r = NaN;
end
%% Two-Plume Interaction Equation (B3 from LF20B)
function f = TwoPlumes_Equation(rho)
global r0 k theta
f = (rho.^2 – 2*rho.*cos(theta) + 1 – r0^2) .* …
(rho.^2 – 2*rho.*cos(theta + pi) + 1 – r0^2) – k^2;
endHello all,
I’m working on a MATLAB script that computes the merging contour between two turbulent plumes, using a custom root-finding function called mnhf_secant. This function implements a supervisor-provided secant method to solve a nonlinear equation that describes the interface between the plumes. The governing equation being solved is located at the bottom of the code and is derived from plume interaction theory.
The issue arises in the else branch of the loop that iterates over polar angles (θ). When the code enters this branch, the contour plot generated shows visible gaps between the red line (plume boundary) and the black line (reference contour), indicating that the solution is not continuous or fails to resolve in those regions.
This breakdown does not occur in the first half of the angular domain (handled by the if condition), where the contours are computed correctly as seen by the continuous black line. The discontinuity seems localized to the else loop, despite using the same root-finding logic.I tried different guesses for the secant function but is not helping to solve for the gaps.
My main question is:
Is there a modification I could implement in the else branch to ensure a continuous contour across the full angular domain? I have attached the code below.
close all; clc; clf
global r0 k theta
%% Parameter input, plume source of finite size
r0 = 1/3;
k_array = [0.3 0.5 0.7 1-r0^2 1]
Nt = 20001; % Must be odd for symmetry
theta_array = linspace(-pi/2, pi/2, Nt);
figure(1); hold on; box on
for jj = 1:length(k_array)
k = k_array(jj);
if k >= 1 – r0^2
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
else
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
% Identify breakdown angle where rho fails
ij = find(isnan(rho_array1(1:round(end/2))));
if ~isempty(ij)
theta_min = theta_array(max(ij)) % closest valid angle before breakdown
theta_array2 = linspace(theta_min, -theta_min, Nt); % symmetric gap domain
rho_array2 = zeros(1, length(theta_array2));
% Solve numerically in gap region
for ii = 1:length(theta_array2)
theta = theta_array2(ii);
rho_array2(ii) = mnhf_secant(@TwoPlumes_Equation, [0.1 0.4], 1e-6, 0);
if rho_array2(ii)<0
rho_array2(ii) = NaN;
end
end
[x2, y2] = pol2cart(theta_array2, rho_array2);
plot(x2, y2, ‘r.’); axis square; xlim([0 2]); ylim([-1 1]);
end
end
pos1 = [1 – r0, -r0, 2*r0, 2*r0];
rectangle(‘Position’, pos1, ‘Curvature’, [1 1], ‘FaceColor’, [0 0 0]);
end
function r=mnhf_secant(Fun,x,tol,trace)
%MNHF_SECANT finds the root of "Fun" using secant scheme.
%
% Fun – name of the external function
% x – vector of length 2, (initial guesses)
% tol – tolerance
% trace – print intermediate results
%
% Usage mnhf_secant(@poly1,[-0.5 2.0],1e-8,1)
% poly1 is the name of the external function.
% [-0.5 2.0] are the initial guesses for the root.
% Check inputs.
if nargin < 4, trace = 1; end
if nargin < 3, tol = 1e-8; end
if (length(x) ~= 2)
error(‘Please provide two initial guesses’)
end
f = feval(Fun,x); % Fun is assumed to accept a vector
for i = 1:100
x3 = x(1)-f(1)*(x(2)-x(1))/(f(2)-f(1)); % Update the guess.
f3 = feval(Fun,x3); % Function evaluation.
if trace, fprintf(1,’%3i %12.5f %12.5fn’, i,x3,f3); end
if abs(f3) < tol % Check for convergenece.
r = x3;
return
else % Reset values for x(1), x(2), f(1) and f(2).
x(1) = x(2); f(1) = f(2); x(2) = x3; f(2) = f3;
end
end
r = NaN;
end
%% Two-Plume Interaction Equation (B3 from LF20B)
function f = TwoPlumes_Equation(rho)
global r0 k theta
f = (rho.^2 – 2*rho.*cos(theta) + 1 – r0^2) .* …
(rho.^2 – 2*rho.*cos(theta + pi) + 1 – r0^2) – k^2;
end Hello all,
I’m working on a MATLAB script that computes the merging contour between two turbulent plumes, using a custom root-finding function called mnhf_secant. This function implements a supervisor-provided secant method to solve a nonlinear equation that describes the interface between the plumes. The governing equation being solved is located at the bottom of the code and is derived from plume interaction theory.
The issue arises in the else branch of the loop that iterates over polar angles (θ). When the code enters this branch, the contour plot generated shows visible gaps between the red line (plume boundary) and the black line (reference contour), indicating that the solution is not continuous or fails to resolve in those regions.
This breakdown does not occur in the first half of the angular domain (handled by the if condition), where the contours are computed correctly as seen by the continuous black line. The discontinuity seems localized to the else loop, despite using the same root-finding logic.I tried different guesses for the secant function but is not helping to solve for the gaps.
My main question is:
Is there a modification I could implement in the else branch to ensure a continuous contour across the full angular domain? I have attached the code below.
close all; clc; clf
global r0 k theta
%% Parameter input, plume source of finite size
r0 = 1/3;
k_array = [0.3 0.5 0.7 1-r0^2 1]
Nt = 20001; % Must be odd for symmetry
theta_array = linspace(-pi/2, pi/2, Nt);
figure(1); hold on; box on
for jj = 1:length(k_array)
k = k_array(jj);
if k >= 1 – r0^2
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
else
rho_array1 = zeros(1,length(theta_array));
for ii = 1:length(theta_array)
theta = theta_array(ii);
rho_array1(ii) = mnhf_secant(@TwoPlumes_Equation, [1.5 2], 1e-6, 0);
if rho_array1(ii)<0
rho_array1(ii) = NaN;
end
end
[x1, y1] = pol2cart(theta_array, rho_array1);
plot(x1, y1, ‘-k’); axis square; xlim([0 2]); ylim([-1 1]);
% Identify breakdown angle where rho fails
ij = find(isnan(rho_array1(1:round(end/2))));
if ~isempty(ij)
theta_min = theta_array(max(ij)) % closest valid angle before breakdown
theta_array2 = linspace(theta_min, -theta_min, Nt); % symmetric gap domain
rho_array2 = zeros(1, length(theta_array2));
% Solve numerically in gap region
for ii = 1:length(theta_array2)
theta = theta_array2(ii);
rho_array2(ii) = mnhf_secant(@TwoPlumes_Equation, [0.1 0.4], 1e-6, 0);
if rho_array2(ii)<0
rho_array2(ii) = NaN;
end
end
[x2, y2] = pol2cart(theta_array2, rho_array2);
plot(x2, y2, ‘r.’); axis square; xlim([0 2]); ylim([-1 1]);
end
end
pos1 = [1 – r0, -r0, 2*r0, 2*r0];
rectangle(‘Position’, pos1, ‘Curvature’, [1 1], ‘FaceColor’, [0 0 0]);
end
function r=mnhf_secant(Fun,x,tol,trace)
%MNHF_SECANT finds the root of "Fun" using secant scheme.
%
% Fun – name of the external function
% x – vector of length 2, (initial guesses)
% tol – tolerance
% trace – print intermediate results
%
% Usage mnhf_secant(@poly1,[-0.5 2.0],1e-8,1)
% poly1 is the name of the external function.
% [-0.5 2.0] are the initial guesses for the root.
% Check inputs.
if nargin < 4, trace = 1; end
if nargin < 3, tol = 1e-8; end
if (length(x) ~= 2)
error(‘Please provide two initial guesses’)
end
f = feval(Fun,x); % Fun is assumed to accept a vector
for i = 1:100
x3 = x(1)-f(1)*(x(2)-x(1))/(f(2)-f(1)); % Update the guess.
f3 = feval(Fun,x3); % Function evaluation.
if trace, fprintf(1,’%3i %12.5f %12.5fn’, i,x3,f3); end
if abs(f3) < tol % Check for convergenece.
r = x3;
return
else % Reset values for x(1), x(2), f(1) and f(2).
x(1) = x(2); f(1) = f(2); x(2) = x3; f(2) = f3;
end
end
r = NaN;
end
%% Two-Plume Interaction Equation (B3 from LF20B)
function f = TwoPlumes_Equation(rho)
global r0 k theta
f = (rho.^2 – 2*rho.*cos(theta) + 1 – r0^2) .* …
(rho.^2 – 2*rho.*cos(theta + pi) + 1 – r0^2) – k^2;
end numerical method, contour plot, discontinuities MATLAB Answers — New Questions
MathWorksUpdateInstaller and R2025a in Linux
Hi!
Until now (e.g., with R2024b), whenever I needed to update my MATLAB in Linux, I used to run
sudo /usr/local/MATLAB/R2024b/bin/glnxa64/MathWorksUpdateInstaller
but I cannot find the equivalent executable for R2025a. Did it change name/location? Or what is the suggested update approach, now?
Note that I can’t simply run the updater from the MATLAB desktop, because as normal user I don’t have privilegies to write in the MATLAB root directory. And I can’t start MATLAB as root, either, because of the name in the license.
Thanks in advance!Hi!
Until now (e.g., with R2024b), whenever I needed to update my MATLAB in Linux, I used to run
sudo /usr/local/MATLAB/R2024b/bin/glnxa64/MathWorksUpdateInstaller
but I cannot find the equivalent executable for R2025a. Did it change name/location? Or what is the suggested update approach, now?
Note that I can’t simply run the updater from the MATLAB desktop, because as normal user I don’t have privilegies to write in the MATLAB root directory. And I can’t start MATLAB as root, either, because of the name in the license.
Thanks in advance! Hi!
Until now (e.g., with R2024b), whenever I needed to update my MATLAB in Linux, I used to run
sudo /usr/local/MATLAB/R2024b/bin/glnxa64/MathWorksUpdateInstaller
but I cannot find the equivalent executable for R2025a. Did it change name/location? Or what is the suggested update approach, now?
Note that I can’t simply run the updater from the MATLAB desktop, because as normal user I don’t have privilegies to write in the MATLAB root directory. And I can’t start MATLAB as root, either, because of the name in the license.
Thanks in advance! update, r2025a, linux MATLAB Answers — New Questions
Associating labels to licenses
While I can see what licenses I have active for my account, the installs are associated to computer labels. How can I determine what computer label a current PC has?
I ask as I am upgrading my PC and want to deactivate a given license, but I need to know which.
Thank you.While I can see what licenses I have active for my account, the installs are associated to computer labels. How can I determine what computer label a current PC has?
I ask as I am upgrading my PC and want to deactivate a given license, but I need to know which.
Thank you. While I can see what licenses I have active for my account, the installs are associated to computer labels. How can I determine what computer label a current PC has?
I ask as I am upgrading my PC and want to deactivate a given license, but I need to know which.
Thank you. licensing MATLAB Answers — New Questions
New Outlook for Windows Enables S/MIME Inheritance Control
Same NoSignOnReply Control for S/MIME Inheritance for Replies as Outlook (Classic)
Message center notification MC1072404 (last updated 21 July 2025) announces the provision of a control over S/MIME inheritance for email replies. The new setting allows tenant administrators to determine whether S/MIME signatures are inherited by default when people use the Reply and Reply All options to generate responses to signed messages.
Essentially, this is the same capability as previously implemented through ADMX Group Policy template files for Outlook (classic), so it’s part of the ongoing work to make sure that the new Outlook is as functional as Outlook classic before the eventual retirement of the old client sometime in 2029 (that date might change if features aren’t in place).
As an online client, the new Outlook depends more on server-based controls than the policy settings stored in the system registry as used by traditional Office apps. Support is rolling out now and should be complete worldwide by early August 2025. Deployment then moves to GCC and should be finished there by late August 2025.
Dropping OWA
When first announced, Microsoft included OWA along with the new Outlook for Windows. This is logical because the two clients share a lot of code. The new Outlook supports functionality that isn’t in OWA, like PSTs (including the recently-introduced export to PST feature) and better offline access, but generally the two clients support the same set of server settings. This is not the case here as Microsoft has decided not to support S/MIME inheritance for replies in OWA.
Updating S/MIME Settings
MC1072404 states that the NoSignOnReply setting is available in Entra ID. This might mean that the tenant S/MIME configuration is stored in Entra ID. However, the Set-SMIMEConfig cmdlet is very much part of both Exchange Server and Exchange Online (the cmdlet goes back at least as far as Exchange 2013 – I can’t recall if it was available for previous versions). Most of the settings manipulated by the cmdlet affect how OWA deals with S/MIME. The NoSignOnReply setting is explicitly excluded for OWA.
In any case, the default value for NoSignOnReply is $true. This means that reply messages created with Reply or Reply All do not inherit the S/MIME signature (Figure 1) from the original message. However, if the original message is encrypted, the replies inherit the same encryption. Microsoft notes that the default setting is useful when an organization has not configured S/MIME signatures for all users.

When the setting is $false, replies inherit the S/MIME signature from the original message. If this is undesirable (for instance, it’s the wrong signature), the user must open S/MIME settings and remove the signature.
Set-SMIMEConfig -NoSignOnReply $false
Details of the S/MIME configuration can be retrieved using the Get-SMIMEConfig cmdlet.
Sites that Duplicate Message Center Notifications are Useless
While checking details of MC1072404, I noticed that there are many sites that simply take the text of message center notifications and publish them as written. No attempt is made to add any value whatsoever in terms of interpretation, insight, or additional information. It’s a wonder to me why people republish message center notifications in this manner. They might get a few page views, but apart from that they clutter up the internet with duplicated material. In fact, given the way that generative AI summaries are now used by Google and other search engines, the number of page views that these sites gain must be much decreased.
We do report on message center notifications, but only when we think we have something useful to add that helps readers understand the nature of the change and how it impacts the Microsoft 365 ecosystem. We don’t always get things right, but at least we’re not a “me too” site.
So much change, all the time. It’s a challenge to stay abreast of all the updates Microsoft makes across the Microsoft 365 ecosystem. Subscribe to the Office 365 for IT Pros eBook to receive monthly insights into what happens, why it happens, and what new features and capabilities mean for your tenant.
Why do I see the wrong Service End Date in my License Center?
Why do I see the wrong Service End Date in my License Center?Why do I see the wrong Service End Date in my License Center? Why do I see the wrong Service End Date in my License Center? MATLAB Answers — New Questions
Anonymous function handle incosistence problem with Fourier functions
Hello, during some optics simulation I dared to shorten my code (a .m type) by making fourier transform an anonymous function as such:
F = @(x) fftshift(fft(ifftshift(x)));
iF = @(x) ifftshift(ifft(fftshift(x)));
poow = @(x) abs(x).^ 2;
with these I would Transform, inverse transform and Find the intensity of the signal but for a reason I don’t know it only works when I post it in the command window… sometimes.
here is an example of it in action:
L = 15; % mm
F = 100; % mm
f0 = 1/100e-3; % lp/mm
f1 = 1/300e-3; % lp/mm
dx = 4e-3; % mm
t = 0:dx:L-dx; % mm
n = length(t);
f = -1/(2*dx):1/L:(1/(2*dx)-1/L);
object = chirp(t,f0,t(end),f1,"quadratic");
I = poow(object);
%% transform the object and display
object_ = F(object);
I_object_ = poow(object_);
Now, the problem is as you might see here is that the error this time is:
Array indices must be positive integers or logical values.
but on my machine its:
Error: File: LiveEditorEvaluationHelperE1735339498.m Line: 57 Column: 7
Invalid expression. Check for missing or extra characters.
Error in LiveEditorEvaluationHelperE1735339498>@(x)fftshift(fft(ifftshift(x))) (line 3)
F = @(x) fftshift(fft(ifftshift(x)));
^
this error happens to all previewed anonymous functions.
I have checked if a simpler handle would work and it does only crash when calling these 3 specific ones when running the script.Hello, during some optics simulation I dared to shorten my code (a .m type) by making fourier transform an anonymous function as such:
F = @(x) fftshift(fft(ifftshift(x)));
iF = @(x) ifftshift(ifft(fftshift(x)));
poow = @(x) abs(x).^ 2;
with these I would Transform, inverse transform and Find the intensity of the signal but for a reason I don’t know it only works when I post it in the command window… sometimes.
here is an example of it in action:
L = 15; % mm
F = 100; % mm
f0 = 1/100e-3; % lp/mm
f1 = 1/300e-3; % lp/mm
dx = 4e-3; % mm
t = 0:dx:L-dx; % mm
n = length(t);
f = -1/(2*dx):1/L:(1/(2*dx)-1/L);
object = chirp(t,f0,t(end),f1,"quadratic");
I = poow(object);
%% transform the object and display
object_ = F(object);
I_object_ = poow(object_);
Now, the problem is as you might see here is that the error this time is:
Array indices must be positive integers or logical values.
but on my machine its:
Error: File: LiveEditorEvaluationHelperE1735339498.m Line: 57 Column: 7
Invalid expression. Check for missing or extra characters.
Error in LiveEditorEvaluationHelperE1735339498>@(x)fftshift(fft(ifftshift(x))) (line 3)
F = @(x) fftshift(fft(ifftshift(x)));
^
this error happens to all previewed anonymous functions.
I have checked if a simpler handle would work and it does only crash when calling these 3 specific ones when running the script. Hello, during some optics simulation I dared to shorten my code (a .m type) by making fourier transform an anonymous function as such:
F = @(x) fftshift(fft(ifftshift(x)));
iF = @(x) ifftshift(ifft(fftshift(x)));
poow = @(x) abs(x).^ 2;
with these I would Transform, inverse transform and Find the intensity of the signal but for a reason I don’t know it only works when I post it in the command window… sometimes.
here is an example of it in action:
L = 15; % mm
F = 100; % mm
f0 = 1/100e-3; % lp/mm
f1 = 1/300e-3; % lp/mm
dx = 4e-3; % mm
t = 0:dx:L-dx; % mm
n = length(t);
f = -1/(2*dx):1/L:(1/(2*dx)-1/L);
object = chirp(t,f0,t(end),f1,"quadratic");
I = poow(object);
%% transform the object and display
object_ = F(object);
I_object_ = poow(object_);
Now, the problem is as you might see here is that the error this time is:
Array indices must be positive integers or logical values.
but on my machine its:
Error: File: LiveEditorEvaluationHelperE1735339498.m Line: 57 Column: 7
Invalid expression. Check for missing or extra characters.
Error in LiveEditorEvaluationHelperE1735339498>@(x)fftshift(fft(ifftshift(x))) (line 3)
F = @(x) fftshift(fft(ifftshift(x)));
^
this error happens to all previewed anonymous functions.
I have checked if a simpler handle would work and it does only crash when calling these 3 specific ones when running the script. fft, ifft, fftshift, ifftshift, anonymous function, fourier MATLAB Answers — New Questions
having error while running fuzzy controller and fuzzy set of matlab 2017 in matlab 2023?
2 inputs and 1 output with mamdani rule.2 inputs and 1 output with mamdani rule. 2 inputs and 1 output with mamdani rule. fuzzy, matlab MATLAB Answers — New Questions
MATLAB R2025a won’t start after uninstalling R2023a
I recently installed Matlab R2025a on my PC with Windows 11 and it worked perfectly. But after I uninstalled R2023a, R2025a won’t launch. The launch screen just takes forever to display. The uninstallation of R2023a was done through Settings-Apps-Installed apps-MATALB R2023a-Uninstall, which was completed successfully. I tried to uninstall R2025a in a similar way but failed. After I clicked "yes" to the prompt "Do you want to allow this app to make changes to your device", nothing happened. I also tried running C:Program FilesMATLABR2025abinwin64MathWorksProductUninstaller.exe in terminal, and afater I clicked "yes’ nothing happened. Then I tried installing R2025a, but couldn’t continue as it said it’s already installed. Now I’m stuck, not able to launch/uninstall/re-install R2025a.
Any advice, please? Thank you.I recently installed Matlab R2025a on my PC with Windows 11 and it worked perfectly. But after I uninstalled R2023a, R2025a won’t launch. The launch screen just takes forever to display. The uninstallation of R2023a was done through Settings-Apps-Installed apps-MATALB R2023a-Uninstall, which was completed successfully. I tried to uninstall R2025a in a similar way but failed. After I clicked "yes" to the prompt "Do you want to allow this app to make changes to your device", nothing happened. I also tried running C:Program FilesMATLABR2025abinwin64MathWorksProductUninstaller.exe in terminal, and afater I clicked "yes’ nothing happened. Then I tried installing R2025a, but couldn’t continue as it said it’s already installed. Now I’m stuck, not able to launch/uninstall/re-install R2025a.
Any advice, please? Thank you. I recently installed Matlab R2025a on my PC with Windows 11 and it worked perfectly. But after I uninstalled R2023a, R2025a won’t launch. The launch screen just takes forever to display. The uninstallation of R2023a was done through Settings-Apps-Installed apps-MATALB R2023a-Uninstall, which was completed successfully. I tried to uninstall R2025a in a similar way but failed. After I clicked "yes" to the prompt "Do you want to allow this app to make changes to your device", nothing happened. I also tried running C:Program FilesMATLABR2025abinwin64MathWorksProductUninstaller.exe in terminal, and afater I clicked "yes’ nothing happened. Then I tried installing R2025a, but couldn’t continue as it said it’s already installed. Now I’m stuck, not able to launch/uninstall/re-install R2025a.
Any advice, please? Thank you. r2025a, uninstallation, won’t launch MATLAB Answers — New Questions
Nice to have – function output argument provide code assist when said function is called
This is a feature which doesn’t apear to currently exist, but I think alot of matlab users would like, particularly ones who write alot of custom classes.
Imagine i have a custom class with some properties:
classdef CustomClass < handle
properties
name (1,1) string = "default name"
varOne (1,1) double = 0
end
methods
function obj = CustomClass(name,varOne)
obj.name = name;
obj.VarOne = varOne;
end
end
end
Then imagine I have a function which returns one of these custom class objects:
function [obj] = Calculation(Var1,Var2,name)
arguments (Input)
Var1 (1,1) double
Var2 (1,1) double
end
arguments (Output)
obj (1,1) CustomClass
end
results = Var1 + Var2;
obj = CustomClass(name,result);
end
With this class and this function which returns one of these class objects, I would like the fact that I provided "(1,1) CustomClass" in the output arguemnts block of function "Calculation(Var1,Var2,name)" to trigger code assist automaticaly show me, when writing code that the retuned value from this funciton has properties "name" and "varOne" in the object.
For istance, if I write the following code with this function and the class in the Matlab search path
testObj = Calculation(1,1,"test");
testObj.varOne = 10; %the property "varOne" doesn’t apear in code assist when writing this line of code
I would like that the fact function "Calcuation(Var1,Var2,name) has the output arguments block enforcing that this function must return an object of "CustomClass" to make code assist recognise that "testObj" is a "CustomClass" object, just as if testObj was an input argument to another function which had an input argument requiring that "testObj" was a "CustomClass" object.
Maybe this is a feature that may be added to matlab in future releases? (please and thank you LOL)This is a feature which doesn’t apear to currently exist, but I think alot of matlab users would like, particularly ones who write alot of custom classes.
Imagine i have a custom class with some properties:
classdef CustomClass < handle
properties
name (1,1) string = "default name"
varOne (1,1) double = 0
end
methods
function obj = CustomClass(name,varOne)
obj.name = name;
obj.VarOne = varOne;
end
end
end
Then imagine I have a function which returns one of these custom class objects:
function [obj] = Calculation(Var1,Var2,name)
arguments (Input)
Var1 (1,1) double
Var2 (1,1) double
end
arguments (Output)
obj (1,1) CustomClass
end
results = Var1 + Var2;
obj = CustomClass(name,result);
end
With this class and this function which returns one of these class objects, I would like the fact that I provided "(1,1) CustomClass" in the output arguemnts block of function "Calculation(Var1,Var2,name)" to trigger code assist automaticaly show me, when writing code that the retuned value from this funciton has properties "name" and "varOne" in the object.
For istance, if I write the following code with this function and the class in the Matlab search path
testObj = Calculation(1,1,"test");
testObj.varOne = 10; %the property "varOne" doesn’t apear in code assist when writing this line of code
I would like that the fact function "Calcuation(Var1,Var2,name) has the output arguments block enforcing that this function must return an object of "CustomClass" to make code assist recognise that "testObj" is a "CustomClass" object, just as if testObj was an input argument to another function which had an input argument requiring that "testObj" was a "CustomClass" object.
Maybe this is a feature that may be added to matlab in future releases? (please and thank you LOL) This is a feature which doesn’t apear to currently exist, but I think alot of matlab users would like, particularly ones who write alot of custom classes.
Imagine i have a custom class with some properties:
classdef CustomClass < handle
properties
name (1,1) string = "default name"
varOne (1,1) double = 0
end
methods
function obj = CustomClass(name,varOne)
obj.name = name;
obj.VarOne = varOne;
end
end
end
Then imagine I have a function which returns one of these custom class objects:
function [obj] = Calculation(Var1,Var2,name)
arguments (Input)
Var1 (1,1) double
Var2 (1,1) double
end
arguments (Output)
obj (1,1) CustomClass
end
results = Var1 + Var2;
obj = CustomClass(name,result);
end
With this class and this function which returns one of these class objects, I would like the fact that I provided "(1,1) CustomClass" in the output arguemnts block of function "Calculation(Var1,Var2,name)" to trigger code assist automaticaly show me, when writing code that the retuned value from this funciton has properties "name" and "varOne" in the object.
For istance, if I write the following code with this function and the class in the Matlab search path
testObj = Calculation(1,1,"test");
testObj.varOne = 10; %the property "varOne" doesn’t apear in code assist when writing this line of code
I would like that the fact function "Calcuation(Var1,Var2,name) has the output arguments block enforcing that this function must return an object of "CustomClass" to make code assist recognise that "testObj" is a "CustomClass" object, just as if testObj was an input argument to another function which had an input argument requiring that "testObj" was a "CustomClass" object.
Maybe this is a feature that may be added to matlab in future releases? (please and thank you LOL) matlab, class MATLAB Answers — New Questions
Entra ID Introduces Linkable Token Identifiers for Audit Events
Identifier Makes it Easier to Track User Activities in a Single Session
An interesting July 21 Technical Community announcement describes the introduction of linkable token identifiers for audit events. Essentially, when a user authenticates a session with Entra ID, the session is stamped with a unique GUID (the linkable token identifier). The linkable token identifier is persistent for the session and is inherited by workloads that support the token and inserted into the audit events generated by those workloads accessed during the session.
The idea is that by tracing the linkable token identifier, you can find out what the user did during a session. Linking audit events through the new identifier makes it easier for investigators to query audit data to discover the set of actions taken during a session and their sequencing. This might be necessary to check if an attacker has compromised an account and is exfiltrating data or taking other actions that you don’t want to happen. Of course, account compromise is less likely to happen when user accounts are protected with strong multifactor authentication like the Microsoft Authenticator app, but that’s another story.
The linkable token identifiers are now available in Entra sign-in logs, Exchange Online audit events, SharePoint Online audit events, Teams audit events, and Graph activity logs. Figure 1 shows the identifiers listed in the Entra sign-in log.

Using Audit Searches to Track Activities
Audit events end up in the unified audit log and the article includes a screen shot showing the results of a search using a linked token identifier. Unhappily, the article doesn’t explain that you must use a keyword search to find events linked to a certain identifier (Figure 2).

The reason why a keyword (free text) search is necessary is that workload developers are inconsistent in how they include linkable token identifiers in the AuditData payload of their events. As you’d expect, Entra ID includes a simple SessionId property in the payload, but other workloads like Exchange Online and SharePoint Online refer to the token as AADSessionId.
Finding and Reporting Activities Based on Identifiers
Which brings me to subject of how to search the audit log with PowerShell for all events with a linkable token identifier. The process is reasonably simple. For example, using the Search-UnifiedAuditLog cmdlet, the code is something like this:
[array]$Records = Search-UnifiedAuditLog -Formatted -StartDate $StartDate -EndDate (Get-Date) -UserIds $UserId -FreeText $Session -SessionCommand ReturnLargeSet -ResultSize 5000 If ($Records.Count -eq 0) { Write-Host "No audit records found for session $Session" Continue } Else { $Records = $Records | Sort-Object Identity -Unique $Records = $Records | Sort-Object {$_.CreationDate -as [datetime]} Write-Host ("Found {0} audit records for session {1}" -f $Records.Count, $Session) }
Reporting Audit Events for All Sessions
The code uses a free text search to find all audit events that include the specified linkable token identifier between two dates, removes any duplicates events from the returned set, and sorts the set by the created date.
But how about extending this to generate a report for all events for all sessions within the 30-day period that Entra ID retains sign-in logs. After all, multiple sessions might be created around the same time, and only one of the sessions might be suspicious. To do this, we need to find the full set of sign-in events captured for a user and find the linkable token identifiers in that set. Here’s how to find that information using the Get-MgBetaAuditLogSignIn cmdlet from the Microsoft Graph PowerShell SDK (the beta cmdlet is needed to return the identifiers):
[array]$Logs = Get-MgBetaAuditLogSignIn -Filter "userPrincipalName eq 'lotte.vetler@office365itpros.com'" -All [array]$Sessions = $Logs | Group-Object SessionId -NoElement | Select-Object -ExpandProperty Name
The $Sessions array now contains the linkable token identifiers, and to generate the report, it’s a matter of looping through the set of identifiers to use each with Search-UnifiedAuditLog to generate the set of audit events for the session. Figure 3 shows the kind of report that can be created from the generated data.

The code I used to create the report is available for download from the Office 365 for IT Pros GitHub repository. In addition to the HTML report, the script also generates a CSV or XLSX file (an Excel worksheet is created if the ImportExcel module is available).
Good for Investigators
I’m sure that investigators will appreciate being able to easily connect the dots to discover what happened during a session. Adding linkable token identifiers to audit events is an example of a low-touch, high-value enhancement for Microsoft 365 tenants. It would be nice if all updates had the same impact.
Need some assistance to write and manage PowerShell scripts for Microsoft 365? Get a copy of the Automating Microsoft 365 with PowerShell eBook, available standalone or as part of the Office 365 for IT Pros eBook bundle.
Compiler ignores MCC options
Dear,
Since I updated to r2025a, I’m encountering issues with the compiler.build.standaloneWindowsApplication method.
In the buildOpts struct I parse to this function, I specify `AdditionalFiles`, but they are not included in the build (nor in the compiled package).
I did some debugging on the builder, and both builder.MccInfo.MccInput as builder.MccInfo.MccCommandString show the Additional files correctly, but once premcc, mcc and postmcc are called, the files are never added to the `FilesToBeDeployed` array (except the icon, splashscreen, and executable).
It seems to be that MCC is ignoring the input commands it receives. With r2024b, this issue did not exist, and the AdditionalFiles were added succesfully at each compile.
How can I fix this?
Best Regards,
JelleDear,
Since I updated to r2025a, I’m encountering issues with the compiler.build.standaloneWindowsApplication method.
In the buildOpts struct I parse to this function, I specify `AdditionalFiles`, but they are not included in the build (nor in the compiled package).
I did some debugging on the builder, and both builder.MccInfo.MccInput as builder.MccInfo.MccCommandString show the Additional files correctly, but once premcc, mcc and postmcc are called, the files are never added to the `FilesToBeDeployed` array (except the icon, splashscreen, and executable).
It seems to be that MCC is ignoring the input commands it receives. With r2024b, this issue did not exist, and the AdditionalFiles were added succesfully at each compile.
How can I fix this?
Best Regards,
Jelle Dear,
Since I updated to r2025a, I’m encountering issues with the compiler.build.standaloneWindowsApplication method.
In the buildOpts struct I parse to this function, I specify `AdditionalFiles`, but they are not included in the build (nor in the compiled package).
I did some debugging on the builder, and both builder.MccInfo.MccInput as builder.MccInfo.MccCommandString show the Additional files correctly, but once premcc, mcc and postmcc are called, the files are never added to the `FilesToBeDeployed` array (except the icon, splashscreen, and executable).
It seems to be that MCC is ignoring the input commands it receives. With r2024b, this issue did not exist, and the AdditionalFiles were added succesfully at each compile.
How can I fix this?
Best Regards,
Jelle compiler, r2025a MATLAB Answers — New Questions