Author: PuTI
matlab/simulink+tensorflow problem
My MATLAB can connect to Python and execute Python statements, but it encounters an error when importing TensorFlow. How can I resolve this?
In the MATLAB command line, when I enter:
py.importlib.import_module(‘tensorflow’)
an error occurs:
“error to use pywrap_tensorflow><module> (line 88)
Python error ImportError: Traceback (most recent call last):
File "C:UsersLENOVO.condaenvsmatlab_testlibsite-packagestensorflowpythonpywrap_tensorflow.py", line 73, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error
message.
Error in __init__><module> (line 40)
Error in <frozen importlib>_call_with_frames_removed (line 228)
Error in <frozen importlib>exec_module (line 850)
Error in <frozen importlib>_load_unlocked (line 680)
Error in <frozen importlib>_find_and_load_unlocked (line 986)
Error in <frozen importlib>_find_and_load (line 1007)
Error in <frozen importlib>_gcd_import (line 1030)
Error in __init__>import_module (line 127)
”
My matlab version is R2024a, python== 3.9, tensorflow-cpu==2.19
When I import TensorFlow in the Python command line, there is no problem, but when I do so in MATLAB, the above error occurs.
I’ve tried a few solutions, but none of them worked:
Install Microsoft Visual C++ Redistributable
Switch tensorflow from GPU version to CPU version
Use Anaconda to isolate dependencies for different projects.
please help me !!!!!My MATLAB can connect to Python and execute Python statements, but it encounters an error when importing TensorFlow. How can I resolve this?
In the MATLAB command line, when I enter:
py.importlib.import_module(‘tensorflow’)
an error occurs:
“error to use pywrap_tensorflow><module> (line 88)
Python error ImportError: Traceback (most recent call last):
File "C:UsersLENOVO.condaenvsmatlab_testlibsite-packagestensorflowpythonpywrap_tensorflow.py", line 73, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error
message.
Error in __init__><module> (line 40)
Error in <frozen importlib>_call_with_frames_removed (line 228)
Error in <frozen importlib>exec_module (line 850)
Error in <frozen importlib>_load_unlocked (line 680)
Error in <frozen importlib>_find_and_load_unlocked (line 986)
Error in <frozen importlib>_find_and_load (line 1007)
Error in <frozen importlib>_gcd_import (line 1030)
Error in __init__>import_module (line 127)
”
My matlab version is R2024a, python== 3.9, tensorflow-cpu==2.19
When I import TensorFlow in the Python command line, there is no problem, but when I do so in MATLAB, the above error occurs.
I’ve tried a few solutions, but none of them worked:
Install Microsoft Visual C++ Redistributable
Switch tensorflow from GPU version to CPU version
Use Anaconda to isolate dependencies for different projects.
please help me !!!!! My MATLAB can connect to Python and execute Python statements, but it encounters an error when importing TensorFlow. How can I resolve this?
In the MATLAB command line, when I enter:
py.importlib.import_module(‘tensorflow’)
an error occurs:
“error to use pywrap_tensorflow><module> (line 88)
Python error ImportError: Traceback (most recent call last):
File "C:UsersLENOVO.condaenvsmatlab_testlibsite-packagestensorflowpythonpywrap_tensorflow.py", line 73, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: Dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors for some common causes and solutions.
If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error
message.
Error in __init__><module> (line 40)
Error in <frozen importlib>_call_with_frames_removed (line 228)
Error in <frozen importlib>exec_module (line 850)
Error in <frozen importlib>_load_unlocked (line 680)
Error in <frozen importlib>_find_and_load_unlocked (line 986)
Error in <frozen importlib>_find_and_load (line 1007)
Error in <frozen importlib>_gcd_import (line 1030)
Error in __init__>import_module (line 127)
”
My matlab version is R2024a, python== 3.9, tensorflow-cpu==2.19
When I import TensorFlow in the Python command line, there is no problem, but when I do so in MATLAB, the above error occurs.
I’ve tried a few solutions, but none of them worked:
Install Microsoft Visual C++ Redistributable
Switch tensorflow from GPU version to CPU version
Use Anaconda to isolate dependencies for different projects.
please help me !!!!! deep learning, tensorflow MATLAB Answers — New Questions
How to understand the input and output arguments of preparets function for network training
For training NARX network, we need to prepare input and target time series data using preparets function. However, the preparets function has many input and output arguments which are confused for me to understand their functioning. I have read the examples about preparets, yet it is still difficult to understand. What is the best practice to understand the preparets and correctly use it under different network training scenarios ?
help preparets
EDIT: removed copyright code.For training NARX network, we need to prepare input and target time series data using preparets function. However, the preparets function has many input and output arguments which are confused for me to understand their functioning. I have read the examples about preparets, yet it is still difficult to understand. What is the best practice to understand the preparets and correctly use it under different network training scenarios ?
help preparets
EDIT: removed copyright code. For training NARX network, we need to prepare input and target time series data using preparets function. However, the preparets function has many input and output arguments which are confused for me to understand their functioning. I have read the examples about preparets, yet it is still difficult to understand. What is the best practice to understand the preparets and correctly use it under different network training scenarios ?
help preparets
EDIT: removed copyright code. network training, narx, preparets MATLAB Answers — New Questions
Patch FaceVertexCData being overwritten by FaceColor
Hello,
I am attempting to set up a patch with R2016b wherein one face of the patch has a certain color, and the rest share another. To do this I set up an (m x 3) array, "FacetColor," that assigned an RGB triplet to every face in the patch, according to its position in the geometry. The patch was then created with the code:
fv=struct(‘faces’,facet,’vertices’,vertex);
h=patch(fv,’FaceVertexCData’, FacetColor, …
‘EdgeColor’, ‘none’, …
‘FaceLighting’, ‘gouraud’, …
‘AmbientStrength’, 0.4);
alpha(h,1);
Unfortunately, whenever I attempt to run this code, MATLAB apparently ignores my FacetColor array and instead uses the default FaceColor value of [0 0 0]. This turns the entire patch uniformly black. I tried setting the FaceColor value to ‘none,’ thinking that doing so might force MATLAB to use the FaceVertexCData field, but instead it causes the patch to turn invisible. How am I configuring this patch incorrectly?
Any advice or assistance would be appreciated! My thanks in advance.Hello,
I am attempting to set up a patch with R2016b wherein one face of the patch has a certain color, and the rest share another. To do this I set up an (m x 3) array, "FacetColor," that assigned an RGB triplet to every face in the patch, according to its position in the geometry. The patch was then created with the code:
fv=struct(‘faces’,facet,’vertices’,vertex);
h=patch(fv,’FaceVertexCData’, FacetColor, …
‘EdgeColor’, ‘none’, …
‘FaceLighting’, ‘gouraud’, …
‘AmbientStrength’, 0.4);
alpha(h,1);
Unfortunately, whenever I attempt to run this code, MATLAB apparently ignores my FacetColor array and instead uses the default FaceColor value of [0 0 0]. This turns the entire patch uniformly black. I tried setting the FaceColor value to ‘none,’ thinking that doing so might force MATLAB to use the FaceVertexCData field, but instead it causes the patch to turn invisible. How am I configuring this patch incorrectly?
Any advice or assistance would be appreciated! My thanks in advance. Hello,
I am attempting to set up a patch with R2016b wherein one face of the patch has a certain color, and the rest share another. To do this I set up an (m x 3) array, "FacetColor," that assigned an RGB triplet to every face in the patch, according to its position in the geometry. The patch was then created with the code:
fv=struct(‘faces’,facet,’vertices’,vertex);
h=patch(fv,’FaceVertexCData’, FacetColor, …
‘EdgeColor’, ‘none’, …
‘FaceLighting’, ‘gouraud’, …
‘AmbientStrength’, 0.4);
alpha(h,1);
Unfortunately, whenever I attempt to run this code, MATLAB apparently ignores my FacetColor array and instead uses the default FaceColor value of [0 0 0]. This turns the entire patch uniformly black. I tried setting the FaceColor value to ‘none,’ thinking that doing so might force MATLAB to use the FaceVertexCData field, but instead it causes the patch to turn invisible. How am I configuring this patch incorrectly?
Any advice or assistance would be appreciated! My thanks in advance. patch, facevertexcdata, facecolor MATLAB Answers — New Questions
I have downloaded this package, but can not seem to use the “readDistance’ command.
I have downloaded this package, but can not seem to use the "readDistance’ command.
distance = readDistanceI have downloaded this package, but can not seem to use the "readDistance’ command.
distance = readDistance I have downloaded this package, but can not seem to use the "readDistance’ command.
distance = readDistance hc-sr04, error MATLAB Answers — New Questions
How can I see the (binomial) value of the AM2302 temperature sensor on the display?
Hi,
I’ve create a DHT11 Sensor Block with this documentation. Create DHT11 Block
But when I click on "Monitor and Tune", I have an error message, see in DHT11_model…txt.
Thanks for your help.Hi,
I’ve create a DHT11 Sensor Block with this documentation. Create DHT11 Block
But when I click on "Monitor and Tune", I have an error message, see in DHT11_model…txt.
Thanks for your help. Hi,
I’ve create a DHT11 Sensor Block with this documentation. Create DHT11 Block
But when I click on "Monitor and Tune", I have an error message, see in DHT11_model…txt.
Thanks for your help. value temperature MATLAB Answers — New Questions
How do I get the total impedance for one circuit of impedances?
I’m trying to get to total impedance where the impedance measurement block is but I can’t connect it to the circuit. Even the PS converter don’t seem to work to connect it to the block or the circuit. Any suggestion on how to make it work or which library and components use just putting the impedances and getting the total one?I’m trying to get to total impedance where the impedance measurement block is but I can’t connect it to the circuit. Even the PS converter don’t seem to work to connect it to the block or the circuit. Any suggestion on how to make it work or which library and components use just putting the impedances and getting the total one? I’m trying to get to total impedance where the impedance measurement block is but I can’t connect it to the circuit. Even the PS converter don’t seem to work to connect it to the block or the circuit. Any suggestion on how to make it work or which library and components use just putting the impedances and getting the total one? impedance, simulink MATLAB Answers — New Questions
In my COMSOL – PHREEQC Coupling using Matlab Interface, how to update solution for next time step??
I’m currently trying to use COMSOL – PHREEQC Coupling using Matlab Interface for reactive transport modeling. I’m trying Wissmeier & Barry (2011) approach for this. Currently, I’m facing the issue of solution from phreeqc is not being updated in comsol and the transport is not evolving in my simulation. I’m trying to simulate example 11 of phreeqc manual (Cation exchange). Can anyone help me with this?I’m currently trying to use COMSOL – PHREEQC Coupling using Matlab Interface for reactive transport modeling. I’m trying Wissmeier & Barry (2011) approach for this. Currently, I’m facing the issue of solution from phreeqc is not being updated in comsol and the transport is not evolving in my simulation. I’m trying to simulate example 11 of phreeqc manual (Cation exchange). Can anyone help me with this? I’m currently trying to use COMSOL – PHREEQC Coupling using Matlab Interface for reactive transport modeling. I’m trying Wissmeier & Barry (2011) approach for this. Currently, I’m facing the issue of solution from phreeqc is not being updated in comsol and the transport is not evolving in my simulation. I’m trying to simulate example 11 of phreeqc manual (Cation exchange). Can anyone help me with this? comsol, phreeqc, livelink, solution vector MATLAB Answers — New Questions
Request for MATLAB Code Review and Correction
The image contains the Transmission Line (TRL) equation. I am trying to develop a MATLAB code that matches this equation accurately. However, I need to verify that the implementation is consistent with the mathematical expression shown in the image.
Could you please review it and help ensure that the MATLAB code correctly follows the TRL equation?
Here this matlab code
clc;
clear;
% ===== Constants =====
c = 3e8; % Speed of light (m/s)
d = 2.62e-3; % Thickness in meters (example: 2.62 mm)
% ——————- Ask user to select Excel file ——————-
[filename, pathname] = uigetfile(‘*.xlsx’, ‘Select your S-parameter Excel file’);
if isequal(filename,0)
error(‘No file selected. Exiting…’);
end
filepath = fullfile(pathname, filename);
% ===== Read data from Excel =====
% Make sure your Excel file has columns: frequency(Hz), e’, e”, u’, u”
data = readmatrix(filepath); % Reads all numeric data
f = data(:,1); % Frequency in Hz
ep_real = data(:,2); % e’
ep_imag = data(:,3); % e”
mu_real = data(:,4); % u’
mu_imag = data(:,5); % u”
% ===== Complex parameters =====
eps_r = ep_real – 1i*ep_imag;
mu_r = mu_real – 1i*mu_imag;
% ===== Input impedance calculation =====
Zin = sqrt(mu_r ./ eps_r) .* tanh(-1i .* (2*pi.*f.*d./c) .* sqrt(mu_r .* eps_r));
% ===== Reflection Loss =====
RL = 20*log10(abs((Zin – 1) ./ (Zin + 1)));
% ===== Reflection coefficient =====
Gamma = abs((Zin – 1) ./ (Zin + 1));
% ===== Absorption percentage =====
Absorption = (1 – Gamma.^2) * 100;
% ===== Display results =====
Result = table(f, RL, Absorption)
% ===== Plot RL =====
figure
plot(f/1e9, RL,’LineWidth’,2)
xlabel(‘Frequency (GHz)’)
ylabel(‘Reflection Loss (dB)’)
title(‘Reflection Loss vs Frequency’)
grid onThe image contains the Transmission Line (TRL) equation. I am trying to develop a MATLAB code that matches this equation accurately. However, I need to verify that the implementation is consistent with the mathematical expression shown in the image.
Could you please review it and help ensure that the MATLAB code correctly follows the TRL equation?
Here this matlab code
clc;
clear;
% ===== Constants =====
c = 3e8; % Speed of light (m/s)
d = 2.62e-3; % Thickness in meters (example: 2.62 mm)
% ——————- Ask user to select Excel file ——————-
[filename, pathname] = uigetfile(‘*.xlsx’, ‘Select your S-parameter Excel file’);
if isequal(filename,0)
error(‘No file selected. Exiting…’);
end
filepath = fullfile(pathname, filename);
% ===== Read data from Excel =====
% Make sure your Excel file has columns: frequency(Hz), e’, e”, u’, u”
data = readmatrix(filepath); % Reads all numeric data
f = data(:,1); % Frequency in Hz
ep_real = data(:,2); % e’
ep_imag = data(:,3); % e”
mu_real = data(:,4); % u’
mu_imag = data(:,5); % u”
% ===== Complex parameters =====
eps_r = ep_real – 1i*ep_imag;
mu_r = mu_real – 1i*mu_imag;
% ===== Input impedance calculation =====
Zin = sqrt(mu_r ./ eps_r) .* tanh(-1i .* (2*pi.*f.*d./c) .* sqrt(mu_r .* eps_r));
% ===== Reflection Loss =====
RL = 20*log10(abs((Zin – 1) ./ (Zin + 1)));
% ===== Reflection coefficient =====
Gamma = abs((Zin – 1) ./ (Zin + 1));
% ===== Absorption percentage =====
Absorption = (1 – Gamma.^2) * 100;
% ===== Display results =====
Result = table(f, RL, Absorption)
% ===== Plot RL =====
figure
plot(f/1e9, RL,’LineWidth’,2)
xlabel(‘Frequency (GHz)’)
ylabel(‘Reflection Loss (dB)’)
title(‘Reflection Loss vs Frequency’)
grid on The image contains the Transmission Line (TRL) equation. I am trying to develop a MATLAB code that matches this equation accurately. However, I need to verify that the implementation is consistent with the mathematical expression shown in the image.
Could you please review it and help ensure that the MATLAB code correctly follows the TRL equation?
Here this matlab code
clc;
clear;
% ===== Constants =====
c = 3e8; % Speed of light (m/s)
d = 2.62e-3; % Thickness in meters (example: 2.62 mm)
% ——————- Ask user to select Excel file ——————-
[filename, pathname] = uigetfile(‘*.xlsx’, ‘Select your S-parameter Excel file’);
if isequal(filename,0)
error(‘No file selected. Exiting…’);
end
filepath = fullfile(pathname, filename);
% ===== Read data from Excel =====
% Make sure your Excel file has columns: frequency(Hz), e’, e”, u’, u”
data = readmatrix(filepath); % Reads all numeric data
f = data(:,1); % Frequency in Hz
ep_real = data(:,2); % e’
ep_imag = data(:,3); % e”
mu_real = data(:,4); % u’
mu_imag = data(:,5); % u”
% ===== Complex parameters =====
eps_r = ep_real – 1i*ep_imag;
mu_r = mu_real – 1i*mu_imag;
% ===== Input impedance calculation =====
Zin = sqrt(mu_r ./ eps_r) .* tanh(-1i .* (2*pi.*f.*d./c) .* sqrt(mu_r .* eps_r));
% ===== Reflection Loss =====
RL = 20*log10(abs((Zin – 1) ./ (Zin + 1)));
% ===== Reflection coefficient =====
Gamma = abs((Zin – 1) ./ (Zin + 1));
% ===== Absorption percentage =====
Absorption = (1 – Gamma.^2) * 100;
% ===== Display results =====
Result = table(f, RL, Absorption)
% ===== Plot RL =====
figure
plot(f/1e9, RL,’LineWidth’,2)
xlabel(‘Frequency (GHz)’)
ylabel(‘Reflection Loss (dB)’)
title(‘Reflection Loss vs Frequency’)
grid on transmission line theory trl equation matlab ma MATLAB Answers — New Questions
Weird Behaviour of Parallel Processing when Using BlockProc
Hello, I a trying to speed up some analysis of an image (4700 v 128 pixels) that needs breaking up into smaller regions (20×128 pixels) and for each region having a calculation done such as the standard deviation (std2)
I thought the combination of Blockproc and the parallel toolbox would be ideal for this.
However, when I run my analysis, I sometmes get a fast completion time of 0.25s, but other times I run it it can take upto 3s.
1: When I start up my matlab session, i start a parallel pool:
% For parallel Processing (init parpool here)
delete(gcp(‘nocreate’)); % but delete any that are already running
c=parcluster(‘local’);
numwks=c.NumWorkers;
ReportMessage(app,[‘Parallel processing: NumWorkers = ‘,num2str(numwks)]);
parpool(‘Processes’,numwks);
p=gcp;
conn=p.Connected;
ReportMessage(app,[‘…Connected ‘,num2str(conn)]);
2: I then run my fucntion from a push button callback.
My function first gets an image off a uiaxes, crops it and then performs the blockproc.
% Fast Analysis (SD)
tstart=tic;
ax=app.UIAxes;
IM=getimage(ax);
[sy,sx]=size(IM);
xl=5950; xr=10680; yb=0; yt=0; dx=xr-xl; % This is for image cropping
rect=[xl, yb, xr-xl,sy-yt-yb]; %[x, y, width, height]
IM2=imcrop(IM,rect);
IM=IM2-min(IM2(:)); % Background subtract
[sy,sx]=size(IM);
ColSize=20; % Number of pixels in each ROI – 20 default
nCols=floor(sx/ColSize);
RowSize = 128;
%BlockProc with Parallel
bss = [RowSize,ColSize]; % Each blockproc region
fh = @(bs) std2(bs.data); % perform this on each block
J = blockproc(IM, bss, fh,’UseParallel’,true);
sd=J’; % Column vector
ReportMessage(app,num2str(toc(tstart)));
Is there something I am doing wrong? Do I need to close and reopen the parpool everytime or something.
Also, if I want the fh function to be a functio that has more than 1 argument, how do I do the syntax.
For example, I have a function (that works fine by itself)
Brenner=fmeasure(Image,’BREN’,[]); %Focus metric
And I have tried to call it into Blockproc via:
fh = @(bs) fmeasure(bs.data,’BREN’,[]);
It doesn’t work properly.Hello, I a trying to speed up some analysis of an image (4700 v 128 pixels) that needs breaking up into smaller regions (20×128 pixels) and for each region having a calculation done such as the standard deviation (std2)
I thought the combination of Blockproc and the parallel toolbox would be ideal for this.
However, when I run my analysis, I sometmes get a fast completion time of 0.25s, but other times I run it it can take upto 3s.
1: When I start up my matlab session, i start a parallel pool:
% For parallel Processing (init parpool here)
delete(gcp(‘nocreate’)); % but delete any that are already running
c=parcluster(‘local’);
numwks=c.NumWorkers;
ReportMessage(app,[‘Parallel processing: NumWorkers = ‘,num2str(numwks)]);
parpool(‘Processes’,numwks);
p=gcp;
conn=p.Connected;
ReportMessage(app,[‘…Connected ‘,num2str(conn)]);
2: I then run my fucntion from a push button callback.
My function first gets an image off a uiaxes, crops it and then performs the blockproc.
% Fast Analysis (SD)
tstart=tic;
ax=app.UIAxes;
IM=getimage(ax);
[sy,sx]=size(IM);
xl=5950; xr=10680; yb=0; yt=0; dx=xr-xl; % This is for image cropping
rect=[xl, yb, xr-xl,sy-yt-yb]; %[x, y, width, height]
IM2=imcrop(IM,rect);
IM=IM2-min(IM2(:)); % Background subtract
[sy,sx]=size(IM);
ColSize=20; % Number of pixels in each ROI – 20 default
nCols=floor(sx/ColSize);
RowSize = 128;
%BlockProc with Parallel
bss = [RowSize,ColSize]; % Each blockproc region
fh = @(bs) std2(bs.data); % perform this on each block
J = blockproc(IM, bss, fh,’UseParallel’,true);
sd=J’; % Column vector
ReportMessage(app,num2str(toc(tstart)));
Is there something I am doing wrong? Do I need to close and reopen the parpool everytime or something.
Also, if I want the fh function to be a functio that has more than 1 argument, how do I do the syntax.
For example, I have a function (that works fine by itself)
Brenner=fmeasure(Image,’BREN’,[]); %Focus metric
And I have tried to call it into Blockproc via:
fh = @(bs) fmeasure(bs.data,’BREN’,[]);
It doesn’t work properly. Hello, I a trying to speed up some analysis of an image (4700 v 128 pixels) that needs breaking up into smaller regions (20×128 pixels) and for each region having a calculation done such as the standard deviation (std2)
I thought the combination of Blockproc and the parallel toolbox would be ideal for this.
However, when I run my analysis, I sometmes get a fast completion time of 0.25s, but other times I run it it can take upto 3s.
1: When I start up my matlab session, i start a parallel pool:
% For parallel Processing (init parpool here)
delete(gcp(‘nocreate’)); % but delete any that are already running
c=parcluster(‘local’);
numwks=c.NumWorkers;
ReportMessage(app,[‘Parallel processing: NumWorkers = ‘,num2str(numwks)]);
parpool(‘Processes’,numwks);
p=gcp;
conn=p.Connected;
ReportMessage(app,[‘…Connected ‘,num2str(conn)]);
2: I then run my fucntion from a push button callback.
My function first gets an image off a uiaxes, crops it and then performs the blockproc.
% Fast Analysis (SD)
tstart=tic;
ax=app.UIAxes;
IM=getimage(ax);
[sy,sx]=size(IM);
xl=5950; xr=10680; yb=0; yt=0; dx=xr-xl; % This is for image cropping
rect=[xl, yb, xr-xl,sy-yt-yb]; %[x, y, width, height]
IM2=imcrop(IM,rect);
IM=IM2-min(IM2(:)); % Background subtract
[sy,sx]=size(IM);
ColSize=20; % Number of pixels in each ROI – 20 default
nCols=floor(sx/ColSize);
RowSize = 128;
%BlockProc with Parallel
bss = [RowSize,ColSize]; % Each blockproc region
fh = @(bs) std2(bs.data); % perform this on each block
J = blockproc(IM, bss, fh,’UseParallel’,true);
sd=J’; % Column vector
ReportMessage(app,num2str(toc(tstart)));
Is there something I am doing wrong? Do I need to close and reopen the parpool everytime or something.
Also, if I want the fh function to be a functio that has more than 1 argument, how do I do the syntax.
For example, I have a function (that works fine by itself)
Brenner=fmeasure(Image,’BREN’,[]); %Focus metric
And I have tried to call it into Blockproc via:
fh = @(bs) fmeasure(bs.data,’BREN’,[]);
It doesn’t work properly. parpool, blockproc, parallel computing toolbox MATLAB Answers — New Questions
system command error within a parfor
Hi all,
I’m getting this error when runnning the code below. I isolated the issue to the use of the system command within the parfor loop. Note however that the same exact code runs fine on another -windows- PC.
Error Identifier: MATLAB:parallel:future:FetchNextFutureErrored
Error Message: The function evaluation completed with an error.
parfor ……
…..
command = …;
system(command);
endHi all,
I’m getting this error when runnning the code below. I isolated the issue to the use of the system command within the parfor loop. Note however that the same exact code runs fine on another -windows- PC.
Error Identifier: MATLAB:parallel:future:FetchNextFutureErrored
Error Message: The function evaluation completed with an error.
parfor ……
…..
command = …;
system(command);
end Hi all,
I’m getting this error when runnning the code below. I isolated the issue to the use of the system command within the parfor loop. Note however that the same exact code runs fine on another -windows- PC.
Error Identifier: MATLAB:parallel:future:FetchNextFutureErrored
Error Message: The function evaluation completed with an error.
parfor ……
…..
command = …;
system(command);
end parallel computing, parfor, system MATLAB Answers — New Questions
How do I reduce the amount of vectors I get from the gradient function without compromising resolution?
The gradient function returns the gradient of a scalar function (in the 3-dimensional case) depending on z-values, which means the gradient is approximated. To get a better approximation it would be best to feed as much z-values into the gradient function as possible. The function returns a gradient vector for every z-value fed to the function. Wanting to visualize the gradient, this means that for higher resolution gradients a lot of vectors are generated, which can create cluttered visualization (i.e. figure 1, where the blue lines underneath the curve represent the gradient vectors).
Is it possible to reduce the amount of vectors returned by the gradient function to improve visualization?The gradient function returns the gradient of a scalar function (in the 3-dimensional case) depending on z-values, which means the gradient is approximated. To get a better approximation it would be best to feed as much z-values into the gradient function as possible. The function returns a gradient vector for every z-value fed to the function. Wanting to visualize the gradient, this means that for higher resolution gradients a lot of vectors are generated, which can create cluttered visualization (i.e. figure 1, where the blue lines underneath the curve represent the gradient vectors).
Is it possible to reduce the amount of vectors returned by the gradient function to improve visualization? The gradient function returns the gradient of a scalar function (in the 3-dimensional case) depending on z-values, which means the gradient is approximated. To get a better approximation it would be best to feed as much z-values into the gradient function as possible. The function returns a gradient vector for every z-value fed to the function. Wanting to visualize the gradient, this means that for higher resolution gradients a lot of vectors are generated, which can create cluttered visualization (i.e. figure 1, where the blue lines underneath the curve represent the gradient vectors).
Is it possible to reduce the amount of vectors returned by the gradient function to improve visualization? gradient, vectors MATLAB Answers — New Questions
How to change the arrangement of plots in a tiled layout even if the plots are not empty?
Is is still not possible to change e.g. from horizontal to vertical arrangment? Why is this not comming?!Is is still not possible to change e.g. from horizontal to vertical arrangment? Why is this not comming?! Is is still not possible to change e.g. from horizontal to vertical arrangment? Why is this not comming?! tiledlayout MATLAB Answers — New Questions
Announcing Copilot leadership update
Satya Nadella, Chairman and CEO, and Mustafa Suleyman, Executive Vice President and CEO of Microsoft AI, shared the below communications with Microsoft employees this morning.
SATYA NADELLA MESSAGE
I want to share two org changes we’re making to our Copilot org and superintelligence effort.
It’s clear a new era of productivity is emerging as AI experiences rapidly evolve from answering questions and suggesting code, to executing multi-step tasks with clear user control points. You see this in our announcements over the last couple of weeks, like Copilot Tasks and Copilot Cowork, agentic capabilities in Office, and Agent 365. As these experiences connect more naturally across agents, apps, and workflows, we have an opportunity to help customers spend more time on higher-value work and reduce manual coordination, while providing people with more agency and empowerment and organizations with the governance and security controls they need.
To that end, we are bringing the Copilot system across commercial and consumer together as one unified effort. This will span four connected pillars: Copilot experience, Copilot platform, Microsoft 365 apps, and AI models. This is how we move from a collection of great products to a truly integrated system, one that is simpler and more powerful for customers.
Jacob Andreou will lead the Copilot experience across consumer and commercial, driving design, product, growth, and engineering, as EVP, Copilot, reporting to me. As CVP of Product and Growth at Microsoft AI, Jacob has accelerated our user-focused AI-first product making and growth framework. Prior to that, he was SVP at Snap, where he helped scale the company from its early days.
Progress at the AI model layer is more critical than ever to our success as a company over the next decade and is foundational to everything we build above it. We are doubling down on our superintelligence mission with the talent and compute to build models that have real product impact, in terms of evals, COGS reduction, as well as advancing the frontier when it comes to meeting enterprise needs and achieving the next set of research breakthroughs. Mustafa Suleyman and I have been working towards this plan for some time, and he will continue to lead this high ambition work, reporting to me. Mustafa is uniquely qualified to drive this forward, with his deep focus and commitment to advancing the frontiers of model science, while also ensuring that human control, agency, and economic opportunity remain at the center of these advancements.
Ryan Roslansky, Perry Clarke, and Charles Lamanna will lead M365 apps and the Copilot platform. Together, Jacob, Ryan, Charles, Perry, and Mustafa make up the Copilot LT and over the next few weeks they’ll work to align the teams.
Our org boundaries will simply reflect system architecture and product shape such that we can deliver more coherent and competitive experiences that continue to evolve with model capabilities. And I am looking forward to how together we apply all of this to empower people, organizations, and the world.
MUSTAFA SULEYMAN MESSAGE
Subject: A new structure for Microsoft AI
Technology and the future of our industry will be defined by two things: frontier models, and the products through which they are experienced. For some time, I’ve been thinking about how we best tackle these huge challenges, and today I’m excited to be evolving our structure at Microsoft AI, ensuring we’re positioned to succeed in both.
I came to Microsoft with an overriding mission: to create Superintelligence that delivers a transformative, positive impact for millions of people. This requires us to build frontier models, at scale, pushing the boundaries of what’s possible. Everything else follows from this. It’s the foundation for our future as a company. With our ambitious, long-term frontier scale compute roadmap locked, we now have everything we need to build truly SOTA models.
As you will have just heard from Satya, the next phase of this plan is to restructure our organization to enable me to focus all my energy on our Superintelligence efforts and be able to deliver world class models for Microsoft over the next 5 years. These models will enable us to build enterprise tuned lineages that help improve all our products across the company. They’ll also enable us to deliver the COGS efficiencies necessary to be able to serve AI workloads at the immense scale required in the coming years. Achieving all this will be a huge challenge, and I’m committing everything we have – and I have personally – to make it happen.
To that end, I’ve been working hard with other leaders in the background for a while now to define a strategy to unify Copilot by bringing together the Consumer and Commercial efforts as one. We all know this makes sense. Every user – whether at home or at work – will be able to enjoy the full benefit of what we are all building. Today, we’re combining these organizations into a single, unified Copilot org. Jacob has demonstrated himself to be an outstanding leader for the product experience and clearly has the product instincts, the operational range, and the conviction to make Copilot a great success.
Jacob will retain a dotted line to me, and I’ll stay directly involved in much of the day-to-day operation of MAI, attending Meetups, MMMs, LT, and supporting Jacob to drive all areas of product strategy. To ensure that the models we build and the products we ship are mutually reinforcing, we are establishing a Copilot Leadership Team that includes me, Jacob, Charles Lamanna, Perry Clarke, and Ryan Roslansky. This will enable us to focus our brand strategy, our product roadmap, our models and our core infrastructure as one to deliver the best experiences possible for all our users.
Thank you for everything you’ve done over the last few years. I know how hard everyone has been pushing and the sacrifices many of you have made to help the company adapt to this new era.
We really do have an incredible opportunity to redefine Microsoft for this agentic revolution.
Mustafa’s mail has been edited slightly for external use.
The post Announcing Copilot leadership update appeared first on The Official Microsoft Blog.
Satya Nadella, Chairman and CEO, and Mustafa Suleyman, Executive Vice President and CEO of Microsoft AI, shared the below communications with Microsoft employees this morning. SATYA NADELLA MESSAGE I want to share two org changes we’re making to our Copilot org and superintelligence effort. It’s clear a new era of productivity is emerging as AI experiences…
The post Announcing Copilot leadership update appeared first on The Official Microsoft Blog.Read More
How to preserve the 3d plot box, when changing patch visibility.
I have a 3d plot with a collection of patches. If I set a subset of patches Visible attributes to ‘off’, the plot box is recomputed. How can I capture and preserve all aspects of the plot box so that the visible patches don’t jump around as other patches become visible or invisible.I have a 3d plot with a collection of patches. If I set a subset of patches Visible attributes to ‘off’, the plot box is recomputed. How can I capture and preserve all aspects of the plot box so that the visible patches don’t jump around as other patches become visible or invisible. I have a 3d plot with a collection of patches. If I set a subset of patches Visible attributes to ‘off’, the plot box is recomputed. How can I capture and preserve all aspects of the plot box so that the visible patches don’t jump around as other patches become visible or invisible. 3d plots, plot box, plot view MATLAB Answers — New Questions
MATLAB Coder generated MEX file throws an error that “Index exceeds matrix dimensions” although the code runs in MATLAB without error
I’m trying to use MATLAB Coder to generate C/C++ code for my MATLAB code. However, when I try to execute the MEX file generated by MATLAB Coder, it throws an error that for a specific variable that the index exceeds matrix dimensions:
>> myCode_mex
Index exceeds matrix dimensions. The array ‘A’ is empty and therefore has no valid indices.
The error stack points to the following MATLAB source code where I perform array extension:
n = length(A);
if n < buffSize
A(n+1) = data;
The same code however runs in MATLAB without any issues. Why does this happen?I’m trying to use MATLAB Coder to generate C/C++ code for my MATLAB code. However, when I try to execute the MEX file generated by MATLAB Coder, it throws an error that for a specific variable that the index exceeds matrix dimensions:
>> myCode_mex
Index exceeds matrix dimensions. The array ‘A’ is empty and therefore has no valid indices.
The error stack points to the following MATLAB source code where I perform array extension:
n = length(A);
if n < buffSize
A(n+1) = data;
The same code however runs in MATLAB without any issues. Why does this happen? I’m trying to use MATLAB Coder to generate C/C++ code for my MATLAB code. However, when I try to execute the MEX file generated by MATLAB Coder, it throws an error that for a specific variable that the index exceeds matrix dimensions:
>> myCode_mex
Index exceeds matrix dimensions. The array ‘A’ is empty and therefore has no valid indices.
The error stack points to the following MATLAB source code where I perform array extension:
n = length(A);
if n < buffSize
A(n+1) = data;
The same code however runs in MATLAB without any issues. Why does this happen? array, index, exceeds, matrix, matlab, coder, extension, ml, codegen MATLAB Answers — New Questions
Confidence interval in fit
By default, the fit function in matlab returns 95 % confidence interval bounds. I want it to return error as defined by 1 sigma confidence, which i think corresponds to 68.27% confidence bound. How do i get this?By default, the fit function in matlab returns 95 % confidence interval bounds. I want it to return error as defined by 1 sigma confidence, which i think corresponds to 68.27% confidence bound. How do i get this? By default, the fit function in matlab returns 95 % confidence interval bounds. I want it to return error as defined by 1 sigma confidence, which i think corresponds to 68.27% confidence bound. How do i get this? curve fitting, nonlinear, error MATLAB Answers — New Questions
Method lookup in multiple inheritance
I defined four classes: a, b, c, and d. Class a defines a method f; class b inherits from a and overrides f; class c inherits from a; class d inherits from both b and c.
Why does calling f(d) print ‘b’? What is MATLAB’s method lookup mechanism?
classdef a
methods
function f(obj)
‘a’
end
end
end
classdef b < a
methods
function f(obj)
‘b’
end
end
end
classdef c < a
methods
end
end
classdef d < a
methods
end
endI defined four classes: a, b, c, and d. Class a defines a method f; class b inherits from a and overrides f; class c inherits from a; class d inherits from both b and c.
Why does calling f(d) print ‘b’? What is MATLAB’s method lookup mechanism?
classdef a
methods
function f(obj)
‘a’
end
end
end
classdef b < a
methods
function f(obj)
‘b’
end
end
end
classdef c < a
methods
end
end
classdef d < a
methods
end
end I defined four classes: a, b, c, and d. Class a defines a method f; class b inherits from a and overrides f; class c inherits from a; class d inherits from both b and c.
Why does calling f(d) print ‘b’? What is MATLAB’s method lookup mechanism?
classdef a
methods
function f(obj)
‘a’
end
end
end
classdef b < a
methods
function f(obj)
‘b’
end
end
end
classdef c < a
methods
end
end
classdef d < a
methods
end
end multiple inheritance MATLAB Answers — New Questions
Microsoft at NVIDIA GTC: New solutions for Microsoft Foundry, Azure AI infrastructure and Physical AI
Microsoft combines accelerated computing with cloud scale engineering to bring advanced AI capabilities to our customers. For years, we’ve worked with NVIDIA to integrate hardware, software and infrastructure to power many of today’s most important AI breakthroughs.
What’s new at NVIDIA GTC
- Expanded Microsoft Foundry capabilities to build, deploy and operate production-ready AI agents on NVIDIA accelerators and open NVIDIA Nemotron models
- New Azure AI infrastructure optimized for inference-heavy, reasoning-based workloads, including the first hyperscale cloud to power on next-generation NVIDIA Vera Rubin NVL72 systems
- Deeper integration across Microsoft Foundry, Microsoft Fabric and NVIDIA Omniverse libraries and open frameworks to support Physical AI systems from simulation to real‑world operations
From Frontier models to production-ready agents
At the foundation of this system is Microsoft Foundry: serving as the operating system for building, deploying and operating AI at enterprise scale. Foundry builds on Azure to bring together models, tools, data and observability into a single system designed for production agents. Today we’re expanding those capabilities across Foundry Agent Service and NVIDIA Nemotron models.
The next-generation Foundry Agent Service and Observability in Foundry Control Plane are now generally available, enabling organizations to build and operate AI agents at production scale. Foundry Agent Service allows teams to quickly develop agents that reason, plan and act across tools, data and workflows. Once created, Foundry Control Plane provides the developer end-to-end visibility into agent behavior, unlocking both developer productivity as well as enterprise trust. Companies such as Corvus Energy are already using Foundry to replace manual inspection workflows with agent-driven operational intelligence across their global fleet.
We are further simplifying the path from prototype to production with the availability of Voice Live API integration with Foundry Agent Service, in public preview, which enables developers to build voice-first, multimodal, real-time agentic experiences. This pairs with the general availability of a refreshed Microsoft Foundry portal and expanded integrations for Palo Alto Networks’ Prisma AIRS and Zenity, delivering deeper builder experiences and runtime security across the entire agent lifecycle.
NVIDIA Nemotron models are also now available through Microsoft Foundry, joining the widest selection of models on any cloud, including the latest reasoning, frontier and open models. This bolsters our recent partnership announcement bringing Fireworks AI to Microsoft Foundry, enabling customers to fine-tune open-weight models like NVIDIA Nemotron into low-latency assets that can be distributed to the edge.
Scaling AI infrastructure for the world’s most demanding workloads
Inference AI workloads are reshaping cost, performance and system design requirements. To operationalize agentic AI at scale, customers need purpose-built infrastructure for inference‑heavy, reasoning‑based workloads that can be deployed and operated consistently across global and regulated environments.
Microsoft’s AI infrastructure approach is engineered to seamlessly bring next-generation NVIDIA systems into Azure datacenters that are designed for power, cooling networking and rapid generational upgrades. This allows our customers to move with speed and agility and stay at the leading edge from generation to generation.
In less than a year, we’ve deployed hundreds of thousands of liquid-cooled Grace Blackwell GPUs across our global datacenter footprint, and now we are excited to be the first hyperscale cloud to power on NVIDIA’s newest Vera Rubin NVL72 in our labs. Over the next few months, Vera Rubin NVL72 will be rolled out into our modern, liquid-cooled Azure datacenters.
Microsoft’s infrastructure innovation with NVIDIA also extends to sovereign and regulated environments to give customers control of both where AI runs and how it evolves over time. Recently, we announced Foundry Local support for modern infrastructure and large AI models, and today we now have initial support for NVIDIA Vera Rubin platform on Azure Local, extending accelerated AI capabilities to customer-controlled environments. This approach allows organizations to plan for next-generation AI workloads, including reasoning-based and agentic systems, while maintaining Azure-consistent operations, governance and security through our unified software layer with Azure Arc and Foundry Local.
Bringing AI into the physical world
As AI moves beyond digital experiences, Microsoft and NVIDIA are collaborating to support the next wave of Physical AI. At GTC, this work centers on NVIDIA Physical AI Data Factory Blueprint, with Microsoft Foundry as the platform for hosting and operating Physical AI systems on Azure at cloud scale.
By integrating this blueprint with Azure services as part of a Physical AI Toolchain, Microsoft enables developers to build, train and operate physical AI and robotics workflows that connect physical assets, simulation and cloud training environments into repeatable, enterprise-grade pipelines. To support, we are introducing a public Azure Physical AI Toolchain GitHub repository integrated with the Nvidia Physical AI Data Factory and with core Azure services.
To further the impact of AI in real‑world, physical environments, today Microsoft and NVIDIA are deepening the integration between Microsoft Fabric and NVIDIA Omniverse libraries, connecting live operational data with physically accurate digital twins and simulation. This allows organizations to see what’s happening across their physical systems, understand it in real time and use AI to decide what to do next. In practice, customers in manufacturing and operations and beyond are using this approach to move beyond dashboards and alerts to coordinated, AI‑driven action across machines, facilities and workflows.
From innovation to impact
Microsoft is delivering reliable, production‑scale AI by bringing together its global AI infrastructure, platforms and real‑world systems with the latest innovation from NVIDIA. For customers, this means the ability to operate intelligence continuously, running inference-heavy, reasoning-based and physical AI workloads with the performance, security and governance required for real businesses and regulated industries.
Whether powering always-on agents, scaling next-generation AI infrastructure or deploying intelligent systems in factories, energy facilities and sovereign environments, Microsoft and Nvidia are helping customers move faster from insight to action.
Yina Arenas leads product strategy and execution for Microsoft Foundry, overseeing the end–to–end AI product portfolio, infrastructure, developer experiences and foundation model integration across OpenAI, Anthropic, Mistral, DeepSeek and others. She delivers an enterprise ready, production grade AI platform trusted by global customers for secure, reliable and scalable AI.
The post Microsoft at NVIDIA GTC: New solutions for Microsoft Foundry, Azure AI infrastructure and Physical AI appeared first on The Official Microsoft Blog.
Microsoft combines accelerated computing with cloud scale engineering to bring advanced AI capabilities to our customers. For years, we’ve worked with NVIDIA to integrate hardware, software and infrastructure to power many of today’s most important AI breakthroughs. What’s new at NVIDIA GTC Expanded Microsoft Foundry capabilities to build, deploy and operate production-ready AI agents on…
The post Microsoft at NVIDIA GTC: New solutions for Microsoft Foundry, Azure AI infrastructure and Physical AI appeared first on The Official Microsoft Blog.Read More
Section folding not present
Using R2024B, i got the option to use the live editor and some things changed without asking.
Most importantly, the + buttons to fold a section have dissappeared, while in preferences/editor/code folding the option sections is ON.
Another change is that the titles of the scripts are in an additional column.
FInally, beneath the folder section, there is a new window with the ‘script’ , i.e. a shortcut to jump to a section.
How can I get the section folding again?
Cheers, PaulUsing R2024B, i got the option to use the live editor and some things changed without asking.
Most importantly, the + buttons to fold a section have dissappeared, while in preferences/editor/code folding the option sections is ON.
Another change is that the titles of the scripts are in an additional column.
FInally, beneath the folder section, there is a new window with the ‘script’ , i.e. a shortcut to jump to a section.
How can I get the section folding again?
Cheers, Paul Using R2024B, i got the option to use the live editor and some things changed without asking.
Most importantly, the + buttons to fold a section have dissappeared, while in preferences/editor/code folding the option sections is ON.
Another change is that the titles of the scripts are in an additional column.
FInally, beneath the folder section, there is a new window with the ‘script’ , i.e. a shortcut to jump to a section.
How can I get the section folding again?
Cheers, Paul section folding MATLAB Answers — New Questions
Some figures not saving as vector graphics (.svg)
Hi,
I ran into a strange problem. I’m trying to save figures in vector format to process in Adobe Illustrator. I make numerous of these plots using one script and in many cases the output to vector graphics using the .svg format works fine. Some figures, made by the same script and apart from the specific datapoints indistinguishable from other figures, do not export as proper vector graphics. In those cases I can open the output .svg file in Illustrator but the image is basically flat; i.e. I can not isolate individual elements for editing.
I have attached two figures extracted at the exact point in the script where the data is added that causes it to not save properly. I plot datapoints on a trial-trial basis, adding data from one trial, then the data from the next trial etc. Until a particular trial I can save the figure as a proper vector graphic .svg file (attached as Fig1Vector.fig). When data from the next trial is added, the output .svg file only contains a flattened image (attached as Fig2NotVector.fig).
I’ve been looking for differences between the two figures but I have exhausted my ideas on what could be at cause. Do any of you have any idea what could be going wrong here or any suggestions to do a successful vector image export?
Thanks in advance.
Best,
PaulHi,
I ran into a strange problem. I’m trying to save figures in vector format to process in Adobe Illustrator. I make numerous of these plots using one script and in many cases the output to vector graphics using the .svg format works fine. Some figures, made by the same script and apart from the specific datapoints indistinguishable from other figures, do not export as proper vector graphics. In those cases I can open the output .svg file in Illustrator but the image is basically flat; i.e. I can not isolate individual elements for editing.
I have attached two figures extracted at the exact point in the script where the data is added that causes it to not save properly. I plot datapoints on a trial-trial basis, adding data from one trial, then the data from the next trial etc. Until a particular trial I can save the figure as a proper vector graphic .svg file (attached as Fig1Vector.fig). When data from the next trial is added, the output .svg file only contains a flattened image (attached as Fig2NotVector.fig).
I’ve been looking for differences between the two figures but I have exhausted my ideas on what could be at cause. Do any of you have any idea what could be going wrong here or any suggestions to do a successful vector image export?
Thanks in advance.
Best,
Paul Hi,
I ran into a strange problem. I’m trying to save figures in vector format to process in Adobe Illustrator. I make numerous of these plots using one script and in many cases the output to vector graphics using the .svg format works fine. Some figures, made by the same script and apart from the specific datapoints indistinguishable from other figures, do not export as proper vector graphics. In those cases I can open the output .svg file in Illustrator but the image is basically flat; i.e. I can not isolate individual elements for editing.
I have attached two figures extracted at the exact point in the script where the data is added that causes it to not save properly. I plot datapoints on a trial-trial basis, adding data from one trial, then the data from the next trial etc. Until a particular trial I can save the figure as a proper vector graphic .svg file (attached as Fig1Vector.fig). When data from the next trial is added, the output .svg file only contains a flattened image (attached as Fig2NotVector.fig).
I’ve been looking for differences between the two figures but I have exhausted my ideas on what could be at cause. Do any of you have any idea what could be going wrong here or any suggestions to do a successful vector image export?
Thanks in advance.
Best,
Paul figure, export, saveas, plot, save, vector graphics, svg, fig MATLAB Answers — New Questions









