Author: PuTI
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
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
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
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
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
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
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
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
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
Material property assignment in electromagnetic solve
In the following scritp I continue to get errors about the material assignemnt.
clear; close all; clc;
% ===== PHYSICAL PARAMETERS =====
lambda = 785e-9; % Wavelength [m]
omega = 2*pi*3e8/lambda; % Angular frequency [rad/s]
eps0 = 8.8541878128e-12; % Vacuum permittivity [F/m]
% ===== MATERIAL PROPERTIES =====
eps_au = (-24.051 + 1.3i) + 25; % Gold permittivity (shifted to Re(ε)>0)
eps_sio2 = 2.25; % SiO2 relative permittivity
% ===== CREATE MODEL =====
model = createpde(‘electromagnetic’,’harmonic’);
model.VacuumPermittivity = eps0;
% ===== GEOMETRY DEFINITION =====
% SiO2 substrate (500nm x 100nm)
rect_sio2 = [3;4; 0;500e-9;500e-9;0; 0;0;100e-9;100e-9];
% Air gap (500nm x 5nm, starting at y=100nm)
gap_y_start = 100e-9;
gap_height = 5e-9;
rect_air = [3;4; 0;500e-9;500e-9;0; …
gap_y_start+1e-12; gap_y_start+1e-12; … % Slightly offset to avoid overlap
gap_y_start+gap_height-1e-12; gap_y_start+gap_height-1e-12];
% Gold nanoparticle (radius 50nm at x=250nm, y=149nm)
circ = [1;250e-9;149e-9;50e-9; zeros(6,1)];
% Combine geometry with constructive solid geometry
gd = [rect_sio2, rect_air, circ];
ns = char(‘sio2′,’airgap’,’gold’)’;
sf = ‘(sio2 + airgap) + gold’; % Proper CSG formula
dl = decsg(gd,sf,ns);
geometryFromEdges(model, dl);
% ===== VISUALIZE FACE LABELS (CRUCIAL STEP) =====
figure;
pdegplot(model,’FaceLabels’,’on’,’EdgeLabels’,’on’);
title(‘Geometry Face Labels’);
axis equal;
% ===== MATERIAL ASSIGNMENT =====
% Assign properties based on face numbers from plot
% NOTE: Face numbers may differ – adjust based on pdegplot output!
electromagneticProperties(model,’Face’,1,’RelativePermittivity’,eps_sio2,…
‘RelativePermeability’,1,’Conductivity’,0); % SiO2
electromagneticProperties(model,’Face’,2,’RelativePermittivity’,1,…
‘RelativePermeability’,1,’Conductivity’,0); % Air
electromagneticProperties(model,’Face’,3,’RelativePermittivity’,eps_au,…
‘RelativePermeability’,1,’Conductivity’,0); % Gold
% ===== BOUNDARY CONDITIONS =====
k_spp = 2*pi/lambda * sqrt(eps_au/(1 + eps_au));
jsFun = @(location,~) exp(1i * k_spp * location.x);
electromagneticBC(model,’Edge’,1,’SurfaceCurrentDensity’,jsFun); % SPP excitation
electromagneticBC(model,’Edge’,[2,4],’FarField’,’absorbing’,…
‘Thickness’,lambda/4); % Absorbing BCs
% ===== MESH GENERATION =====
generateMesh(model,…
‘Hmax’,lambda/20, …
‘Hmin’,gap_height/2, …
‘Hgrad’,1.3, …
‘GeometricOrder’,’linear’);
figure;
pdemesh(model);
title(‘Mesh’);
axis equal;
% ===== SOLVE & VISUALIZE =====
result = solve(model,’Frequency’,omega);
E = result.ElectricField;
Emag = sqrt(abs(E.Ex).^2 + abs(E.Ey).^2 + abs(E.Ez).^2);
figure;
pdeplot(model,’XYData’,Emag,’ColorMap’,’jet’,’Mesh’,’off’);
title(‘Electric Field Magnitude |E|’);
colorbar;
axis equal;In the following scritp I continue to get errors about the material assignemnt.
clear; close all; clc;
% ===== PHYSICAL PARAMETERS =====
lambda = 785e-9; % Wavelength [m]
omega = 2*pi*3e8/lambda; % Angular frequency [rad/s]
eps0 = 8.8541878128e-12; % Vacuum permittivity [F/m]
% ===== MATERIAL PROPERTIES =====
eps_au = (-24.051 + 1.3i) + 25; % Gold permittivity (shifted to Re(ε)>0)
eps_sio2 = 2.25; % SiO2 relative permittivity
% ===== CREATE MODEL =====
model = createpde(‘electromagnetic’,’harmonic’);
model.VacuumPermittivity = eps0;
% ===== GEOMETRY DEFINITION =====
% SiO2 substrate (500nm x 100nm)
rect_sio2 = [3;4; 0;500e-9;500e-9;0; 0;0;100e-9;100e-9];
% Air gap (500nm x 5nm, starting at y=100nm)
gap_y_start = 100e-9;
gap_height = 5e-9;
rect_air = [3;4; 0;500e-9;500e-9;0; …
gap_y_start+1e-12; gap_y_start+1e-12; … % Slightly offset to avoid overlap
gap_y_start+gap_height-1e-12; gap_y_start+gap_height-1e-12];
% Gold nanoparticle (radius 50nm at x=250nm, y=149nm)
circ = [1;250e-9;149e-9;50e-9; zeros(6,1)];
% Combine geometry with constructive solid geometry
gd = [rect_sio2, rect_air, circ];
ns = char(‘sio2′,’airgap’,’gold’)’;
sf = ‘(sio2 + airgap) + gold’; % Proper CSG formula
dl = decsg(gd,sf,ns);
geometryFromEdges(model, dl);
% ===== VISUALIZE FACE LABELS (CRUCIAL STEP) =====
figure;
pdegplot(model,’FaceLabels’,’on’,’EdgeLabels’,’on’);
title(‘Geometry Face Labels’);
axis equal;
% ===== MATERIAL ASSIGNMENT =====
% Assign properties based on face numbers from plot
% NOTE: Face numbers may differ – adjust based on pdegplot output!
electromagneticProperties(model,’Face’,1,’RelativePermittivity’,eps_sio2,…
‘RelativePermeability’,1,’Conductivity’,0); % SiO2
electromagneticProperties(model,’Face’,2,’RelativePermittivity’,1,…
‘RelativePermeability’,1,’Conductivity’,0); % Air
electromagneticProperties(model,’Face’,3,’RelativePermittivity’,eps_au,…
‘RelativePermeability’,1,’Conductivity’,0); % Gold
% ===== BOUNDARY CONDITIONS =====
k_spp = 2*pi/lambda * sqrt(eps_au/(1 + eps_au));
jsFun = @(location,~) exp(1i * k_spp * location.x);
electromagneticBC(model,’Edge’,1,’SurfaceCurrentDensity’,jsFun); % SPP excitation
electromagneticBC(model,’Edge’,[2,4],’FarField’,’absorbing’,…
‘Thickness’,lambda/4); % Absorbing BCs
% ===== MESH GENERATION =====
generateMesh(model,…
‘Hmax’,lambda/20, …
‘Hmin’,gap_height/2, …
‘Hgrad’,1.3, …
‘GeometricOrder’,’linear’);
figure;
pdemesh(model);
title(‘Mesh’);
axis equal;
% ===== SOLVE & VISUALIZE =====
result = solve(model,’Frequency’,omega);
E = result.ElectricField;
Emag = sqrt(abs(E.Ex).^2 + abs(E.Ey).^2 + abs(E.Ez).^2);
figure;
pdeplot(model,’XYData’,Emag,’ColorMap’,’jet’,’Mesh’,’off’);
title(‘Electric Field Magnitude |E|’);
colorbar;
axis equal; In the following scritp I continue to get errors about the material assignemnt.
clear; close all; clc;
% ===== PHYSICAL PARAMETERS =====
lambda = 785e-9; % Wavelength [m]
omega = 2*pi*3e8/lambda; % Angular frequency [rad/s]
eps0 = 8.8541878128e-12; % Vacuum permittivity [F/m]
% ===== MATERIAL PROPERTIES =====
eps_au = (-24.051 + 1.3i) + 25; % Gold permittivity (shifted to Re(ε)>0)
eps_sio2 = 2.25; % SiO2 relative permittivity
% ===== CREATE MODEL =====
model = createpde(‘electromagnetic’,’harmonic’);
model.VacuumPermittivity = eps0;
% ===== GEOMETRY DEFINITION =====
% SiO2 substrate (500nm x 100nm)
rect_sio2 = [3;4; 0;500e-9;500e-9;0; 0;0;100e-9;100e-9];
% Air gap (500nm x 5nm, starting at y=100nm)
gap_y_start = 100e-9;
gap_height = 5e-9;
rect_air = [3;4; 0;500e-9;500e-9;0; …
gap_y_start+1e-12; gap_y_start+1e-12; … % Slightly offset to avoid overlap
gap_y_start+gap_height-1e-12; gap_y_start+gap_height-1e-12];
% Gold nanoparticle (radius 50nm at x=250nm, y=149nm)
circ = [1;250e-9;149e-9;50e-9; zeros(6,1)];
% Combine geometry with constructive solid geometry
gd = [rect_sio2, rect_air, circ];
ns = char(‘sio2′,’airgap’,’gold’)’;
sf = ‘(sio2 + airgap) + gold’; % Proper CSG formula
dl = decsg(gd,sf,ns);
geometryFromEdges(model, dl);
% ===== VISUALIZE FACE LABELS (CRUCIAL STEP) =====
figure;
pdegplot(model,’FaceLabels’,’on’,’EdgeLabels’,’on’);
title(‘Geometry Face Labels’);
axis equal;
% ===== MATERIAL ASSIGNMENT =====
% Assign properties based on face numbers from plot
% NOTE: Face numbers may differ – adjust based on pdegplot output!
electromagneticProperties(model,’Face’,1,’RelativePermittivity’,eps_sio2,…
‘RelativePermeability’,1,’Conductivity’,0); % SiO2
electromagneticProperties(model,’Face’,2,’RelativePermittivity’,1,…
‘RelativePermeability’,1,’Conductivity’,0); % Air
electromagneticProperties(model,’Face’,3,’RelativePermittivity’,eps_au,…
‘RelativePermeability’,1,’Conductivity’,0); % Gold
% ===== BOUNDARY CONDITIONS =====
k_spp = 2*pi/lambda * sqrt(eps_au/(1 + eps_au));
jsFun = @(location,~) exp(1i * k_spp * location.x);
electromagneticBC(model,’Edge’,1,’SurfaceCurrentDensity’,jsFun); % SPP excitation
electromagneticBC(model,’Edge’,[2,4],’FarField’,’absorbing’,…
‘Thickness’,lambda/4); % Absorbing BCs
% ===== MESH GENERATION =====
generateMesh(model,…
‘Hmax’,lambda/20, …
‘Hmin’,gap_height/2, …
‘Hgrad’,1.3, …
‘GeometricOrder’,’linear’);
figure;
pdemesh(model);
title(‘Mesh’);
axis equal;
% ===== SOLVE & VISUALIZE =====
result = solve(model,’Frequency’,omega);
E = result.ElectricField;
Emag = sqrt(abs(E.Ex).^2 + abs(E.Ey).^2 + abs(E.Ez).^2);
figure;
pdeplot(model,’XYData’,Emag,’ColorMap’,’jet’,’Mesh’,’off’);
title(‘Electric Field Magnitude |E|’);
colorbar;
axis equal; pde, electromagnetic model, properties MATLAB Answers — New Questions
Issue transposing a matrix inside of a timeseries
Hello everyone,
Im trying to transpose a matrix defined inside of a timeseries:
Rk = timeseries(parentDataset.reflectometry.density’, parentDataset.reflectometry.time);
parentDataset.reflectometry.density is a 7×1 matrix that I need to transpose to become 1×7 however its returning a 1x1x7. I tried using squeeze, reshape or permute to no avail.
I also tried transposing the matrix before feeding it inside the timeseries but I’m also meeting the same issue.
What really confuses me is that when parentDataset.reflectometry.density is a 1×7, transposing it actually returns a 7×1 matrix (and returns 2 when checking wiht ndims).
How can i fix this? And what am I misunderstnading?
Thanks for any help!Hello everyone,
Im trying to transpose a matrix defined inside of a timeseries:
Rk = timeseries(parentDataset.reflectometry.density’, parentDataset.reflectometry.time);
parentDataset.reflectometry.density is a 7×1 matrix that I need to transpose to become 1×7 however its returning a 1x1x7. I tried using squeeze, reshape or permute to no avail.
I also tried transposing the matrix before feeding it inside the timeseries but I’m also meeting the same issue.
What really confuses me is that when parentDataset.reflectometry.density is a 1×7, transposing it actually returns a 7×1 matrix (and returns 2 when checking wiht ndims).
How can i fix this? And what am I misunderstnading?
Thanks for any help! Hello everyone,
Im trying to transpose a matrix defined inside of a timeseries:
Rk = timeseries(parentDataset.reflectometry.density’, parentDataset.reflectometry.time);
parentDataset.reflectometry.density is a 7×1 matrix that I need to transpose to become 1×7 however its returning a 1x1x7. I tried using squeeze, reshape or permute to no avail.
I also tried transposing the matrix before feeding it inside the timeseries but I’m also meeting the same issue.
What really confuses me is that when parentDataset.reflectometry.density is a 1×7, transposing it actually returns a 7×1 matrix (and returns 2 when checking wiht ndims).
How can i fix this? And what am I misunderstnading?
Thanks for any help! matlab MATLAB Answers — New Questions
Details pane missing in 2025a
I have just installed 2025a and the details pane in the main command window is missing. I can’t find the setting to restore it. It’s reall y useful to load single variables from mat files and add other variables so I really miss it! Attached image shows it in 2024bI have just installed 2025a and the details pane in the main command window is missing. I can’t find the setting to restore it. It’s reall y useful to load single variables from mat files and add other variables so I really miss it! Attached image shows it in 2024b I have just installed 2025a and the details pane in the main command window is missing. I can’t find the setting to restore it. It’s reall y useful to load single variables from mat files and add other variables so I really miss it! Attached image shows it in 2024b details pane, r2025a complaints MATLAB Answers — New Questions
Adding external files to Matlab Compiler app in R2025a
Unfortunately I had to upgrade to R2025a recently and have been hugely disppointed by what seems like a massive regression in the app compiling workflow using Matlab Compiler. In R2024a, which I was using before, I was confident I could have got my app packaged up in 15 minutes, with R2025a I’ve been battling with it for over a day and still finding it troublesome. Has anyone else had experience using this on a complex project?
This huge change is not adequately covered in Release Notes nor in product help, but now you have to have a Matlab project in order to compile using the app. I’ve never used projects before (they seemed to offer nothing for our work style) so already this was a big change. But they have serious restrictions compared to past versions too.
It seems to accept code not being under the project folder no problem, which is a relief as I have a large repository of code that is used and I can’t put it all under a project directory. However, I also use dlls, some icons, etc and in the past I could simply add these to the ‘Files required for your application to run’ section of the compiler. They would end up in the exact same relative location on the user’s machine so my functions that use relative paths to read them worked fine in deployed apps too.
But now, in R2025 the ‘Custom requirements’ section of ‘Files required for Standalone to run’ insists on any file that is added being under the project folder. This means I have to take a copy of dlls, icons, etc and put them there. But these files get unpacked to a completely different location on the target machine, so any code that expects these to exist in a certain relative folder location breaks.
I can use ctfroot to take me to the parent folder where the app is deployed, but not the specific app folder under that, so I have to search around under that folder to find my dlls in some subfolder.
This is a fundamental change from R2024a and I am very disappointed by such a massive regression in the workflow. Matlab has always been excellent at backwards compatibility in almost every area, but this has made what used to be a relatively efficient process into something that is a struggle to make work at all.Unfortunately I had to upgrade to R2025a recently and have been hugely disppointed by what seems like a massive regression in the app compiling workflow using Matlab Compiler. In R2024a, which I was using before, I was confident I could have got my app packaged up in 15 minutes, with R2025a I’ve been battling with it for over a day and still finding it troublesome. Has anyone else had experience using this on a complex project?
This huge change is not adequately covered in Release Notes nor in product help, but now you have to have a Matlab project in order to compile using the app. I’ve never used projects before (they seemed to offer nothing for our work style) so already this was a big change. But they have serious restrictions compared to past versions too.
It seems to accept code not being under the project folder no problem, which is a relief as I have a large repository of code that is used and I can’t put it all under a project directory. However, I also use dlls, some icons, etc and in the past I could simply add these to the ‘Files required for your application to run’ section of the compiler. They would end up in the exact same relative location on the user’s machine so my functions that use relative paths to read them worked fine in deployed apps too.
But now, in R2025 the ‘Custom requirements’ section of ‘Files required for Standalone to run’ insists on any file that is added being under the project folder. This means I have to take a copy of dlls, icons, etc and put them there. But these files get unpacked to a completely different location on the target machine, so any code that expects these to exist in a certain relative folder location breaks.
I can use ctfroot to take me to the parent folder where the app is deployed, but not the specific app folder under that, so I have to search around under that folder to find my dlls in some subfolder.
This is a fundamental change from R2024a and I am very disappointed by such a massive regression in the workflow. Matlab has always been excellent at backwards compatibility in almost every area, but this has made what used to be a relatively efficient process into something that is a struggle to make work at all. Unfortunately I had to upgrade to R2025a recently and have been hugely disppointed by what seems like a massive regression in the app compiling workflow using Matlab Compiler. In R2024a, which I was using before, I was confident I could have got my app packaged up in 15 minutes, with R2025a I’ve been battling with it for over a day and still finding it troublesome. Has anyone else had experience using this on a complex project?
This huge change is not adequately covered in Release Notes nor in product help, but now you have to have a Matlab project in order to compile using the app. I’ve never used projects before (they seemed to offer nothing for our work style) so already this was a big change. But they have serious restrictions compared to past versions too.
It seems to accept code not being under the project folder no problem, which is a relief as I have a large repository of code that is used and I can’t put it all under a project directory. However, I also use dlls, some icons, etc and in the past I could simply add these to the ‘Files required for your application to run’ section of the compiler. They would end up in the exact same relative location on the user’s machine so my functions that use relative paths to read them worked fine in deployed apps too.
But now, in R2025 the ‘Custom requirements’ section of ‘Files required for Standalone to run’ insists on any file that is added being under the project folder. This means I have to take a copy of dlls, icons, etc and put them there. But these files get unpacked to a completely different location on the target machine, so any code that expects these to exist in a certain relative folder location breaks.
I can use ctfroot to take me to the parent folder where the app is deployed, but not the specific app folder under that, so I have to search around under that folder to find my dlls in some subfolder.
This is a fundamental change from R2024a and I am very disappointed by such a massive regression in the workflow. Matlab has always been excellent at backwards compatibility in almost every area, but this has made what used to be a relatively efficient process into something that is a struggle to make work at all. compiler, projects MATLAB Answers — New Questions
Wrong number of Edges/Faces after .stl-Import with fegeometry
When I create a femodel-Object from an existing .stl-file, some edges/faces get lost and I don’t know how/why/where. My original 3D-model looks like this:
However, when I create the femodel with
geometryFile = ‘Pilz.stl’;
geometryFile = fegeometry(geometryFile);
the edges from two of the four opposite faces tangent to the clyinder part of the mushroom get lost, see below picture:
I need these four faces to apply a FaceLoad later on, but F3 in this case is not just the flat area but also the two rounded faces up to the edge of F1.
I’m guessing it is not a problem with the .stl-file itself, because I’ve varied the width of the flat areas up to the point where the cylinder part is basically a square, but MATLAB still only recognizes 4 faces around the circumference.
How do I get MATLAB or the fegeometry function to recognize the missing Faces like so:?
Thanks in advance!When I create a femodel-Object from an existing .stl-file, some edges/faces get lost and I don’t know how/why/where. My original 3D-model looks like this:
However, when I create the femodel with
geometryFile = ‘Pilz.stl’;
geometryFile = fegeometry(geometryFile);
the edges from two of the four opposite faces tangent to the clyinder part of the mushroom get lost, see below picture:
I need these four faces to apply a FaceLoad later on, but F3 in this case is not just the flat area but also the two rounded faces up to the edge of F1.
I’m guessing it is not a problem with the .stl-file itself, because I’ve varied the width of the flat areas up to the point where the cylinder part is basically a square, but MATLAB still only recognizes 4 faces around the circumference.
How do I get MATLAB or the fegeometry function to recognize the missing Faces like so:?
Thanks in advance! When I create a femodel-Object from an existing .stl-file, some edges/faces get lost and I don’t know how/why/where. My original 3D-model looks like this:
However, when I create the femodel with
geometryFile = ‘Pilz.stl’;
geometryFile = fegeometry(geometryFile);
the edges from two of the four opposite faces tangent to the clyinder part of the mushroom get lost, see below picture:
I need these four faces to apply a FaceLoad later on, but F3 in this case is not just the flat area but also the two rounded faces up to the edge of F1.
I’m guessing it is not a problem with the .stl-file itself, because I’ve varied the width of the flat areas up to the point where the cylinder part is basically a square, but MATLAB still only recognizes 4 faces around the circumference.
How do I get MATLAB or the fegeometry function to recognize the missing Faces like so:?
Thanks in advance! femodel, stl, 3d, edges, mesh MATLAB Answers — New Questions