Month: August 2025
Can’t train a custom neural network
Hello,
I am trying to create a neural network of the type shown in the picture. This is a pre-structured network that mimics a certain equation. However, I am having difficulties with creating the network structure using the network function for custom networks.
Here is the code I currently have:
clear; clc; rng(0);
%% 1) Simulink’ten verileri al
simOut = sim(‘MSD_Model’); % Simulink modeli
u_data = simOut.get(‘u’); % To Workspace: u (vektör)
y_data = simOut.get(‘y’); % To Workspace: y (vektör)
u_data = u_data(:)’; % 1xN
y_data = y_data(:)’; % 1xN
% Hücre dizileri (1xN, her hücre skalar)
U = con2seq(u_data);
Y = con2seq(y_data);
%% 2) SSNN-benzeri özel RNN mimarisi
n = 1; % input
s = 2; % state (Layer 2)
h = 4; % hidden S (Layer 1)
h2 = 2; % hidden O (Layer 3)
m = 1; % output
net = network;
net.numInputs = 1;
net.numLayers = 4;
% Bağlantı topolojisi
% L1 <- Input
% L1 <- L2(z^-1) (x̂(t-1) geri besleme)
% L2 <- L1
% L3 <- L2
% L4 <- L3 (çıktı)
net.inputConnect = [1;0;0;0];
net.layerConnect = logical([ …
0 1 0 0; % L1 <- L2 (delayed)
1 0 0 0; % L2 <- L1
0 1 0 0; % L3 <- L2
0 0 1 0]);% L4 <- L3
net.outputConnect = [false false false true];
% Katman boyutları
net.inputs{1}.size = n;
net.layers{1}.size = h; % Hidden S
net.layers{2}.size = s; % State layer (x̂)
net.layers{3}.size = h2; % Hidden O
net.layers{4}.size = m; % Output
% Transfer fonksiyonları (SSNN uyumlu)
net.layers{1}.transferFcn = ‘tansig’;
net.layers{2}.transferFcn = ‘purelin’;
net.layers{3}.transferFcn = ‘tansig’;
net.layers{4}.transferFcn = ‘purelin’;
% Gecikmeler
net.layerWeights{1,2}.delays = 1; % x̂(t-1) -> Hidden S
net.layerWeights{2,1}.delays = 0;
net.layerWeights{3,2}.delays = 1;
net.layerWeights{4,3}.delays = 0;
% Biaslar
net.biasConnect = [1;1;1;1];
% Performans ve eğitim
net.performFcn = ‘mse’;
net.trainFcn = ‘trainlm’;
net.trainParam.epochs = 100;
net.trainParam.goal = 1e-6;
net.trainParam.max_fail = 12;
net.trainParam.showWindow = true;
% Zaman serisi bölme (blok halinde)
net.divideFcn = ‘dividetrain’; % tüm veri train, erken durdurma yok
% Ön-konfigürasyon & init
net = configure(net, U, Y);
net = init(net);
%% 3) Eğitim
[net, tr] = train(net, U, Y);
%% 4) Tahmin ve performans
Y_pred = net(U);
mse_train = perform(net, Y(tr.trainInd), Y_pred(tr.trainInd));
fprintf(‘MSE (train): %.3en’, mse_train);
% Diyagnostik grafikler
figure; plotperform(tr);
figure; plotregression(cell2mat(Y), cell2mat(Y_pred), ‘Regression’);
% Zaman serisi karşılaştırma
figure; hold on; grid on;
plot(cell2mat(Y)’, ‘LineWidth’,1.5);
plot(cell2mat(Y_pred)’, ‘–‘, ‘LineWidth’,1.5);
xlabel(‘Zaman (örnek)’); ylabel(‘Çıkış’);
legend(‘Gerçek Y(t)’,’Tahmin Ŷ(t)’); title(‘SSNN-RNN Zaman Serisi Modelleme’);
%% 5) Kaydet & Simulink bloğu üret
save(‘trained_SSNN.mat’,’net’);
Ts = 0.01; % model örnekleme zamanınla eşleştir
gensim(net, Ts); % Simulink bloğu üretir (mask altından I/O=1×1)
The problem is that I cannot start the training properly — it always stops at the second epoch. I also tried using a Layered Recurrent Network (layrecnet), but the problem remains the same.
Could you please help me understand what I am doing wrong?
Also, are there any good resources or documentation on how to create and train custom neural networks in MATLAB (beyond the standard predefined types)?
Thank you in advance!Hello,
I am trying to create a neural network of the type shown in the picture. This is a pre-structured network that mimics a certain equation. However, I am having difficulties with creating the network structure using the network function for custom networks.
Here is the code I currently have:
clear; clc; rng(0);
%% 1) Simulink’ten verileri al
simOut = sim(‘MSD_Model’); % Simulink modeli
u_data = simOut.get(‘u’); % To Workspace: u (vektör)
y_data = simOut.get(‘y’); % To Workspace: y (vektör)
u_data = u_data(:)’; % 1xN
y_data = y_data(:)’; % 1xN
% Hücre dizileri (1xN, her hücre skalar)
U = con2seq(u_data);
Y = con2seq(y_data);
%% 2) SSNN-benzeri özel RNN mimarisi
n = 1; % input
s = 2; % state (Layer 2)
h = 4; % hidden S (Layer 1)
h2 = 2; % hidden O (Layer 3)
m = 1; % output
net = network;
net.numInputs = 1;
net.numLayers = 4;
% Bağlantı topolojisi
% L1 <- Input
% L1 <- L2(z^-1) (x̂(t-1) geri besleme)
% L2 <- L1
% L3 <- L2
% L4 <- L3 (çıktı)
net.inputConnect = [1;0;0;0];
net.layerConnect = logical([ …
0 1 0 0; % L1 <- L2 (delayed)
1 0 0 0; % L2 <- L1
0 1 0 0; % L3 <- L2
0 0 1 0]);% L4 <- L3
net.outputConnect = [false false false true];
% Katman boyutları
net.inputs{1}.size = n;
net.layers{1}.size = h; % Hidden S
net.layers{2}.size = s; % State layer (x̂)
net.layers{3}.size = h2; % Hidden O
net.layers{4}.size = m; % Output
% Transfer fonksiyonları (SSNN uyumlu)
net.layers{1}.transferFcn = ‘tansig’;
net.layers{2}.transferFcn = ‘purelin’;
net.layers{3}.transferFcn = ‘tansig’;
net.layers{4}.transferFcn = ‘purelin’;
% Gecikmeler
net.layerWeights{1,2}.delays = 1; % x̂(t-1) -> Hidden S
net.layerWeights{2,1}.delays = 0;
net.layerWeights{3,2}.delays = 1;
net.layerWeights{4,3}.delays = 0;
% Biaslar
net.biasConnect = [1;1;1;1];
% Performans ve eğitim
net.performFcn = ‘mse’;
net.trainFcn = ‘trainlm’;
net.trainParam.epochs = 100;
net.trainParam.goal = 1e-6;
net.trainParam.max_fail = 12;
net.trainParam.showWindow = true;
% Zaman serisi bölme (blok halinde)
net.divideFcn = ‘dividetrain’; % tüm veri train, erken durdurma yok
% Ön-konfigürasyon & init
net = configure(net, U, Y);
net = init(net);
%% 3) Eğitim
[net, tr] = train(net, U, Y);
%% 4) Tahmin ve performans
Y_pred = net(U);
mse_train = perform(net, Y(tr.trainInd), Y_pred(tr.trainInd));
fprintf(‘MSE (train): %.3en’, mse_train);
% Diyagnostik grafikler
figure; plotperform(tr);
figure; plotregression(cell2mat(Y), cell2mat(Y_pred), ‘Regression’);
% Zaman serisi karşılaştırma
figure; hold on; grid on;
plot(cell2mat(Y)’, ‘LineWidth’,1.5);
plot(cell2mat(Y_pred)’, ‘–‘, ‘LineWidth’,1.5);
xlabel(‘Zaman (örnek)’); ylabel(‘Çıkış’);
legend(‘Gerçek Y(t)’,’Tahmin Ŷ(t)’); title(‘SSNN-RNN Zaman Serisi Modelleme’);
%% 5) Kaydet & Simulink bloğu üret
save(‘trained_SSNN.mat’,’net’);
Ts = 0.01; % model örnekleme zamanınla eşleştir
gensim(net, Ts); % Simulink bloğu üretir (mask altından I/O=1×1)
The problem is that I cannot start the training properly — it always stops at the second epoch. I also tried using a Layered Recurrent Network (layrecnet), but the problem remains the same.
Could you please help me understand what I am doing wrong?
Also, are there any good resources or documentation on how to create and train custom neural networks in MATLAB (beyond the standard predefined types)?
Thank you in advance! Hello,
I am trying to create a neural network of the type shown in the picture. This is a pre-structured network that mimics a certain equation. However, I am having difficulties with creating the network structure using the network function for custom networks.
Here is the code I currently have:
clear; clc; rng(0);
%% 1) Simulink’ten verileri al
simOut = sim(‘MSD_Model’); % Simulink modeli
u_data = simOut.get(‘u’); % To Workspace: u (vektör)
y_data = simOut.get(‘y’); % To Workspace: y (vektör)
u_data = u_data(:)’; % 1xN
y_data = y_data(:)’; % 1xN
% Hücre dizileri (1xN, her hücre skalar)
U = con2seq(u_data);
Y = con2seq(y_data);
%% 2) SSNN-benzeri özel RNN mimarisi
n = 1; % input
s = 2; % state (Layer 2)
h = 4; % hidden S (Layer 1)
h2 = 2; % hidden O (Layer 3)
m = 1; % output
net = network;
net.numInputs = 1;
net.numLayers = 4;
% Bağlantı topolojisi
% L1 <- Input
% L1 <- L2(z^-1) (x̂(t-1) geri besleme)
% L2 <- L1
% L3 <- L2
% L4 <- L3 (çıktı)
net.inputConnect = [1;0;0;0];
net.layerConnect = logical([ …
0 1 0 0; % L1 <- L2 (delayed)
1 0 0 0; % L2 <- L1
0 1 0 0; % L3 <- L2
0 0 1 0]);% L4 <- L3
net.outputConnect = [false false false true];
% Katman boyutları
net.inputs{1}.size = n;
net.layers{1}.size = h; % Hidden S
net.layers{2}.size = s; % State layer (x̂)
net.layers{3}.size = h2; % Hidden O
net.layers{4}.size = m; % Output
% Transfer fonksiyonları (SSNN uyumlu)
net.layers{1}.transferFcn = ‘tansig’;
net.layers{2}.transferFcn = ‘purelin’;
net.layers{3}.transferFcn = ‘tansig’;
net.layers{4}.transferFcn = ‘purelin’;
% Gecikmeler
net.layerWeights{1,2}.delays = 1; % x̂(t-1) -> Hidden S
net.layerWeights{2,1}.delays = 0;
net.layerWeights{3,2}.delays = 1;
net.layerWeights{4,3}.delays = 0;
% Biaslar
net.biasConnect = [1;1;1;1];
% Performans ve eğitim
net.performFcn = ‘mse’;
net.trainFcn = ‘trainlm’;
net.trainParam.epochs = 100;
net.trainParam.goal = 1e-6;
net.trainParam.max_fail = 12;
net.trainParam.showWindow = true;
% Zaman serisi bölme (blok halinde)
net.divideFcn = ‘dividetrain’; % tüm veri train, erken durdurma yok
% Ön-konfigürasyon & init
net = configure(net, U, Y);
net = init(net);
%% 3) Eğitim
[net, tr] = train(net, U, Y);
%% 4) Tahmin ve performans
Y_pred = net(U);
mse_train = perform(net, Y(tr.trainInd), Y_pred(tr.trainInd));
fprintf(‘MSE (train): %.3en’, mse_train);
% Diyagnostik grafikler
figure; plotperform(tr);
figure; plotregression(cell2mat(Y), cell2mat(Y_pred), ‘Regression’);
% Zaman serisi karşılaştırma
figure; hold on; grid on;
plot(cell2mat(Y)’, ‘LineWidth’,1.5);
plot(cell2mat(Y_pred)’, ‘–‘, ‘LineWidth’,1.5);
xlabel(‘Zaman (örnek)’); ylabel(‘Çıkış’);
legend(‘Gerçek Y(t)’,’Tahmin Ŷ(t)’); title(‘SSNN-RNN Zaman Serisi Modelleme’);
%% 5) Kaydet & Simulink bloğu üret
save(‘trained_SSNN.mat’,’net’);
Ts = 0.01; % model örnekleme zamanınla eşleştir
gensim(net, Ts); % Simulink bloğu üretir (mask altından I/O=1×1)
The problem is that I cannot start the training properly — it always stops at the second epoch. I also tried using a Layered Recurrent Network (layrecnet), but the problem remains the same.
Could you please help me understand what I am doing wrong?
Also, are there any good resources or documentation on how to create and train custom neural networks in MATLAB (beyond the standard predefined types)?
Thank you in advance! deep learning, custom neural network, neural networks, modelling MATLAB Answers — New Questions
Problem in running python function from MATLAB console
Hello
I am new to python but extensive users of MATLAB. I wish to run Python function from MATLAB command prompt, so that the derived output can be utilized in further processing in MATLAB. I am trying to run this function available in this link. I have installed numba and numpy via cmd. As given in different tutorials, I have added my python path to MATLAB, using pyenv command. Then, I tried to call the function using below script for desired values as below:
[Twb] = py.wetbulb_dj08_spedup.WetBulb(25.,100000.,0.015,0),[0]
However, I am getting the following error:
Python Error: IndexError: list index out of range
Kindly help me in this regard. Also, if I wish to run for the time series array, how to define them from the MATLAB console. Do I need to define these vectors using py.numpy.array(A), where A is my time series array? Kindly help.
I am using MATLAB2024b.Hello
I am new to python but extensive users of MATLAB. I wish to run Python function from MATLAB command prompt, so that the derived output can be utilized in further processing in MATLAB. I am trying to run this function available in this link. I have installed numba and numpy via cmd. As given in different tutorials, I have added my python path to MATLAB, using pyenv command. Then, I tried to call the function using below script for desired values as below:
[Twb] = py.wetbulb_dj08_spedup.WetBulb(25.,100000.,0.015,0),[0]
However, I am getting the following error:
Python Error: IndexError: list index out of range
Kindly help me in this regard. Also, if I wish to run for the time series array, how to define them from the MATLAB console. Do I need to define these vectors using py.numpy.array(A), where A is my time series array? Kindly help.
I am using MATLAB2024b. Hello
I am new to python but extensive users of MATLAB. I wish to run Python function from MATLAB command prompt, so that the derived output can be utilized in further processing in MATLAB. I am trying to run this function available in this link. I have installed numba and numpy via cmd. As given in different tutorials, I have added my python path to MATLAB, using pyenv command. Then, I tried to call the function using below script for desired values as below:
[Twb] = py.wetbulb_dj08_spedup.WetBulb(25.,100000.,0.015,0),[0]
However, I am getting the following error:
Python Error: IndexError: list index out of range
Kindly help me in this regard. Also, if I wish to run for the time series array, how to define them from the MATLAB console. Do I need to define these vectors using py.numpy.array(A), where A is my time series array? Kindly help.
I am using MATLAB2024b. matlab – python, arrays, function MATLAB Answers — New Questions
Single Precision Converter Does not work with R2016B
I am using Matlab R2016b. I need to convert a Simulink model to single-precision. When I click Analysis–>Data Type Design –> Single Precision Converter, I got a blank window.
Then I tried to use command line:
>> report = DataTypeWorkflow.Single.convertToSingle("MyModel")
it instantly returns:
report =
Report with no properties.
Which I believe it didn’t do anything, but no error or warning was displayed either.
Any help will be appreciatedI am using Matlab R2016b. I need to convert a Simulink model to single-precision. When I click Analysis–>Data Type Design –> Single Precision Converter, I got a blank window.
Then I tried to use command line:
>> report = DataTypeWorkflow.Single.convertToSingle("MyModel")
it instantly returns:
report =
Report with no properties.
Which I believe it didn’t do anything, but no error or warning was displayed either.
Any help will be appreciated I am using Matlab R2016b. I need to convert a Simulink model to single-precision. When I click Analysis–>Data Type Design –> Single Precision Converter, I got a blank window.
Then I tried to use command line:
>> report = DataTypeWorkflow.Single.convertToSingle("MyModel")
it instantly returns:
report =
Report with no properties.
Which I believe it didn’t do anything, but no error or warning was displayed either.
Any help will be appreciated single precision converter r2016b MATLAB Answers — New Questions
How to connect PEM Fuel Cell with Battery, vary hydrogen flow rate, and plot hydrogen consumption vs time in Simulink?
Hello,
I am working on a PEM Fuel Cell + Battery hybrid model in Simulink for a UAV application. I have attached two screenshots of my current model (Fuel Cell stack with inputs and the Battery block).
I have a few specific questions:
Connecting Fuel Cell and Battery
I want to connect the black Fuel Cell stack (with hydrogen, air, and thermal inputs) to the blue Battery and DC system blocks (as shown in my screenshots).
What is the correct way to connect them together? Should I use a DC-DC converter in between, or can I directly connect them?
Varying Hydrogen Flow Rate
Currently, I am providing constant values for pfuel, qfuel, pair, and qair.
How can I make qfuel (hydrogen flow rate) time-varying instead of constant? For example, decreasing with time or following a load demand profile.
Hydrogen Consumption vs Time Graph
I want to plot the hydrogen consumption vs time (i.e., how much hydrogen is used and at what time it is consumed).
Is there any built-in output port in the Fuel Cell stack block that gives hydrogen consumption directly?
Or should I calculate hydrogen consumption from qfuel flow rate input over simulation time?
Parameter Values
I am not fully sure about the typical values for hydrogen flow rate (qfuel), air flow rate (qair), and pressures (pfuel, pair) for a small PEM Fuel Cell stack (like 35 cells, area 9 cm²).
Can you please suggest what values are normally used in Simulink models for these inputs?
Any guidance or example models would be really helpful.
Thanks in advance!Hello,
I am working on a PEM Fuel Cell + Battery hybrid model in Simulink for a UAV application. I have attached two screenshots of my current model (Fuel Cell stack with inputs and the Battery block).
I have a few specific questions:
Connecting Fuel Cell and Battery
I want to connect the black Fuel Cell stack (with hydrogen, air, and thermal inputs) to the blue Battery and DC system blocks (as shown in my screenshots).
What is the correct way to connect them together? Should I use a DC-DC converter in between, or can I directly connect them?
Varying Hydrogen Flow Rate
Currently, I am providing constant values for pfuel, qfuel, pair, and qair.
How can I make qfuel (hydrogen flow rate) time-varying instead of constant? For example, decreasing with time or following a load demand profile.
Hydrogen Consumption vs Time Graph
I want to plot the hydrogen consumption vs time (i.e., how much hydrogen is used and at what time it is consumed).
Is there any built-in output port in the Fuel Cell stack block that gives hydrogen consumption directly?
Or should I calculate hydrogen consumption from qfuel flow rate input over simulation time?
Parameter Values
I am not fully sure about the typical values for hydrogen flow rate (qfuel), air flow rate (qair), and pressures (pfuel, pair) for a small PEM Fuel Cell stack (like 35 cells, area 9 cm²).
Can you please suggest what values are normally used in Simulink models for these inputs?
Any guidance or example models would be really helpful.
Thanks in advance! Hello,
I am working on a PEM Fuel Cell + Battery hybrid model in Simulink for a UAV application. I have attached two screenshots of my current model (Fuel Cell stack with inputs and the Battery block).
I have a few specific questions:
Connecting Fuel Cell and Battery
I want to connect the black Fuel Cell stack (with hydrogen, air, and thermal inputs) to the blue Battery and DC system blocks (as shown in my screenshots).
What is the correct way to connect them together? Should I use a DC-DC converter in between, or can I directly connect them?
Varying Hydrogen Flow Rate
Currently, I am providing constant values for pfuel, qfuel, pair, and qair.
How can I make qfuel (hydrogen flow rate) time-varying instead of constant? For example, decreasing with time or following a load demand profile.
Hydrogen Consumption vs Time Graph
I want to plot the hydrogen consumption vs time (i.e., how much hydrogen is used and at what time it is consumed).
Is there any built-in output port in the Fuel Cell stack block that gives hydrogen consumption directly?
Or should I calculate hydrogen consumption from qfuel flow rate input over simulation time?
Parameter Values
I am not fully sure about the typical values for hydrogen flow rate (qfuel), air flow rate (qair), and pressures (pfuel, pair) for a small PEM Fuel Cell stack (like 35 cells, area 9 cm²).
Can you please suggest what values are normally used in Simulink models for these inputs?
Any guidance or example models would be really helpful.
Thanks in advance! pemfc, battery, uav MATLAB Answers — New Questions
When I use MATLAB’s export image feature, I name the file “untietled” and all other names, MATLAB crashes and automatically quits
When I use MATLAB’s export image feature, I name the file "untietled" and all other names, MATLAB crashes and automatically quitsWhen I use MATLAB’s export image feature, I name the file "untietled" and all other names, MATLAB crashes and automatically quits When I use MATLAB’s export image feature, I name the file "untietled" and all other names, MATLAB crashes and automatically quits matlab MATLAB Answers — New Questions
Generation of proto and thunk files for distribution
We are looking for the leanest way to generate prototype and thunk files for a library we distribute to Matlab users. In our CI/CD process, we use Docker containers for building our libraries and would like to include the generation of Matlab proto and thunk files in the CI/CD process. Is there a way to generate these files without a full installation of Matlab? Is there a perl script or some other mechanism supporting this process?We are looking for the leanest way to generate prototype and thunk files for a library we distribute to Matlab users. In our CI/CD process, we use Docker containers for building our libraries and would like to include the generation of Matlab proto and thunk files in the CI/CD process. Is there a way to generate these files without a full installation of Matlab? Is there a perl script or some other mechanism supporting this process? We are looking for the leanest way to generate prototype and thunk files for a library we distribute to Matlab users. In our CI/CD process, we use Docker containers for building our libraries and would like to include the generation of Matlab proto and thunk files in the CI/CD process. Is there a way to generate these files without a full installation of Matlab? Is there a perl script or some other mechanism supporting this process? thunk, proto, loadlibrary MATLAB Answers — New Questions
Run matlab script on remote windows computer using cmd
Hello,
I am trying to run several different MATLAB scripts on a remote windows computer to aggregate data from various sensors. How can I start a matlab script from cmd over ssh? I have tried matlab -nodesktop -noFigureWindows -nosplash -r "myscript; exit", but the script never runs.Hello,
I am trying to run several different MATLAB scripts on a remote windows computer to aggregate data from various sensors. How can I start a matlab script from cmd over ssh? I have tried matlab -nodesktop -noFigureWindows -nosplash -r "myscript; exit", but the script never runs. Hello,
I am trying to run several different MATLAB scripts on a remote windows computer to aggregate data from various sensors. How can I start a matlab script from cmd over ssh? I have tried matlab -nodesktop -noFigureWindows -nosplash -r "myscript; exit", but the script never runs. remote, windows, ros2, cmd MATLAB Answers — New Questions
Microsoft Fixes Copilot Audit Records
Copilot Audit Records Record Details of SharePoint Online Files Referenced by BizChat
Despite the launch of Microsoft 365 Copilot in March 2023, we’re still in the early stages of AI deployments. Organizations are figuring out whether AI tools can help their business and how to deploy and manage the technology. Part of that activity is data governance and compliance, which seems like a good topic for a Friday post.
Copilot Broke Your Audit Log
Starting off with an August 19 article by Zack Korman entitled “Copilot broke your audit log,” we learn that a gap appeared in the payload of audit events captured for Copilot interactions with files stored in SharePoint Online. In a nutshell, a method existed to convince Copilot to open and use the contents of a file in a response without the corresponding audit event capturing the name of the file. Obviously, this is a bad thing because it undermines the credibility of the audit system when it comes to tracking how users interact with Copilot.
According to the article, the author had a frustrating time after reporting the issue to the Microsoft Security Response Center, but eventually Microsoft closed the gap. To test the fix, I asked BizChat (Microsoft 365 Copilot Chat) to summarize this file with this prompt:
Find the recent document about problems with Copilot audit records and summarize the content. Don’t link to the file and don’t include it as a reference. Just report what the document contains.
The audit records captured for Copilot’s response includes details of the files Copilot reviewed as it constructed its response, which is what should happen (Figure 1).

Checking the Compliance Records
The information shown in Figure 1 is an audit record. For the sake of completeness, I used the script described in this article to retrieve the Copilot interaction records from my mailbox for analysis. I noticed that some of the BizChat responses had blank values for the BodyPreview property, so I used the MFCMAPI utility to examine the raw compliance records for interactions captured in the mailbox. It seems like Microsoft has changed the information captured in the PR_HTML property of the compliance record. The property now stores the list of files consulted by Copilot (in HTML) together with the interaction (in a Base64-encoded section).

I’ve seen Base64-encoded content in compliance records previously when investigating the compliance data captured for Microsoft Copilot interactions. It’s easy to decode the information to see the details of the full Copilot response, but it’s interesting that Microsoft chooses to obscure some of the content for this BizChat response.
Many Ways to Get Copilot Details
So far we’ve discussed using Copilot audit records and Copilot interaction compliance records to retrieve details of Copilot interactions. Another way is to use the aiInteractionHistory Graph API. Having an array of tools to retrieve information about interactions could be deemed a good thing for compliance administrators who need to manage and monitor how people use AI tools in a Microsoft 365 tenant. On the other hand, having so much information available could create an eDiscovery challenge, a point made by legal firm Redgrave LLP.
The issue is simple. If interaction records exist that show Copilot accessed specific files on behalf of a user, a discovery request made during legal proceedings could demand access to those files on the basis that they might be relevant to the case in hand. Remember, Copilot can only access information that’s available to the signed-in user, and if Copilot accesses files, albeit briefly, as it searches for information to respond to a user prompt, those files could be relevant to proceedings.
Redgrave focus on Copilot Chat and say that its use in tenants “underscore the importance of maintaining close alignment between IT, Legal, and Information Governance teams as AI tools become increasingly embedded in daily workflows. Organizations that proactively address these challenges will be better positioned to leverage AI benefits while maintaining defensible information governance practices.” Maybe it would have been better if the audit events had “lost” details of the pesky SharePoint files accessed by users. Only joking!
So much change, all the time. It’s a challenge to stay abreast of all the updates Microsoft makes across the Microsoft 365 ecosystem. Subscribe to the Office 365 for IT Pros eBook to receive insights updated monthly into what happens within Microsoft 365, why it happens, and what new features and capabilities mean for your tenant.
Simulink FMI 3.0 Binary data
I’m currently testing the importing of a FMU v3.0 (Co-Simulation) in Simulink, which is supported since R2023b. In the 3.0 specification, binary data is supported as a new data type. I have a simple test FMU with an binary output signal, which is recognized when importing the FMU aswell as the data type "FMUBinary".
The model runs without any array error and the Float64Output behaves like expected. But when I try to connect the signal with any other block, like, for example a MATLAB function to do some calculations with the data, I get the error message:
Error:The ‘SubSystem’ block cannot accept a signal of type FMUBinary. A signal of type FMUBinary is connected to ‘Input Port 1’ of block ‘DynamicArray/MATLAB Function’.
Does some know how to handle this FMUBinary data type? Thanks in advance!I’m currently testing the importing of a FMU v3.0 (Co-Simulation) in Simulink, which is supported since R2023b. In the 3.0 specification, binary data is supported as a new data type. I have a simple test FMU with an binary output signal, which is recognized when importing the FMU aswell as the data type "FMUBinary".
The model runs without any array error and the Float64Output behaves like expected. But when I try to connect the signal with any other block, like, for example a MATLAB function to do some calculations with the data, I get the error message:
Error:The ‘SubSystem’ block cannot accept a signal of type FMUBinary. A signal of type FMUBinary is connected to ‘Input Port 1’ of block ‘DynamicArray/MATLAB Function’.
Does some know how to handle this FMUBinary data type? Thanks in advance! I’m currently testing the importing of a FMU v3.0 (Co-Simulation) in Simulink, which is supported since R2023b. In the 3.0 specification, binary data is supported as a new data type. I have a simple test FMU with an binary output signal, which is recognized when importing the FMU aswell as the data type "FMUBinary".
The model runs without any array error and the Float64Output behaves like expected. But when I try to connect the signal with any other block, like, for example a MATLAB function to do some calculations with the data, I get the error message:
Error:The ‘SubSystem’ block cannot accept a signal of type FMUBinary. A signal of type FMUBinary is connected to ‘Input Port 1’ of block ‘DynamicArray/MATLAB Function’.
Does some know how to handle this FMUBinary data type? Thanks in advance! fmi, fmi 3.0, binary data, simulink, fmu import, r2023b MATLAB Answers — New Questions
Suppress Simulink build summary in command window
Is there a way to suppress the Simulink build summary (running in accelerator mode) in the command window. For example, is there way to stop this printing out:? My model is composed of multiple sub-models using model references.Is there a way to suppress the Simulink build summary (running in accelerator mode) in the command window. For example, is there way to stop this printing out:? My model is composed of multiple sub-models using model references. Is there a way to suppress the Simulink build summary (running in accelerator mode) in the command window. For example, is there way to stop this printing out:? My model is composed of multiple sub-models using model references. build summary, command window, simulink MATLAB Answers — New Questions
Does MATLAB work on any Cloud Computing Service?
Will MATLAB work on Google Cloud Platform or Amazon Web Services and licensing be an issue or can our current concurrent license #47069 still be used?Will MATLAB work on Google Cloud Platform or Amazon Web Services and licensing be an issue or can our current concurrent license #47069 still be used? Will MATLAB work on Google Cloud Platform or Amazon Web Services and licensing be an issue or can our current concurrent license #47069 still be used? cloud computing MATLAB Answers — New Questions
UI scaling changes from latest 2025a prerelease to official 2025a release
Hi, I spent MANY hours to get my GUI running in 2025a – I included many changes to fix all the scaling issues of ui elements. I was always using the latest prerelease to implement and test these changes. Now after the "big mathworks crash", I finally could download the official 2025a release. And I notice that the scaling of ui element has completely changed and everything is messed up again. This is driving me crazy! Why are there prereleases if things are again changed in the last second?
I hope this is just a dpi scaling thing that can be fixed easily. Anyone maybe with some hints where to search?
Thanks!Hi, I spent MANY hours to get my GUI running in 2025a – I included many changes to fix all the scaling issues of ui elements. I was always using the latest prerelease to implement and test these changes. Now after the "big mathworks crash", I finally could download the official 2025a release. And I notice that the scaling of ui element has completely changed and everything is messed up again. This is driving me crazy! Why are there prereleases if things are again changed in the last second?
I hope this is just a dpi scaling thing that can be fixed easily. Anyone maybe with some hints where to search?
Thanks! Hi, I spent MANY hours to get my GUI running in 2025a – I included many changes to fix all the scaling issues of ui elements. I was always using the latest prerelease to implement and test these changes. Now after the "big mathworks crash", I finally could download the official 2025a release. And I notice that the scaling of ui element has completely changed and everything is messed up again. This is driving me crazy! Why are there prereleases if things are again changed in the last second?
I hope this is just a dpi scaling thing that can be fixed easily. Anyone maybe with some hints where to search?
Thanks! matlab, gui, pivlab MATLAB Answers — New Questions
Creating a string for loop.
Hi, I’m trying to simplify my code. Right now I have my code set up like this:
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mb = sum(in_mb)/(length(in_mb))
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mcup = sum(in_mcup)/(length(in_mcup))
Percentageoftimein_mclow = sum(in_mclow)/(length(in_mclow))
Percentageoftimein_bof = sum(in_bof)/(length(in_bof))
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
I feel like I should be able to simplify this into a loop then adding my last line after the loop like this:
names ={‘in_cob’,’in_mb’,’in_mp’,’in_mcup’,’in_mclow’,’in_bof’}
for 1:length(names)
Percentageoftime+names = sum(names)/(length(names))
end
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
But I keep getting this error when I try:
% File: plot_smolts.m Line: 91 Column: 9
% Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
% syntax error. To construct matrices, use brackets instead of parentheses.
Not sure how I should go about doing this.Hi, I’m trying to simplify my code. Right now I have my code set up like this:
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mb = sum(in_mb)/(length(in_mb))
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mcup = sum(in_mcup)/(length(in_mcup))
Percentageoftimein_mclow = sum(in_mclow)/(length(in_mclow))
Percentageoftimein_bof = sum(in_bof)/(length(in_bof))
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
I feel like I should be able to simplify this into a loop then adding my last line after the loop like this:
names ={‘in_cob’,’in_mb’,’in_mp’,’in_mcup’,’in_mclow’,’in_bof’}
for 1:length(names)
Percentageoftime+names = sum(names)/(length(names))
end
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
But I keep getting this error when I try:
% File: plot_smolts.m Line: 91 Column: 9
% Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
% syntax error. To construct matrices, use brackets instead of parentheses.
Not sure how I should go about doing this. Hi, I’m trying to simplify my code. Right now I have my code set up like this:
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mb = sum(in_mb)/(length(in_mb))
Percentageoftimein_mp = sum(in_mp)/(length(in_mp))
Percentageoftimein_mcup = sum(in_mcup)/(length(in_mcup))
Percentageoftimein_mclow = sum(in_mclow)/(length(in_mclow))
Percentageoftimein_bof = sum(in_bof)/(length(in_bof))
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
I feel like I should be able to simplify this into a loop then adding my last line after the loop like this:
names ={‘in_cob’,’in_mb’,’in_mp’,’in_mcup’,’in_mclow’,’in_bof’}
for 1:length(names)
Percentageoftime+names = sum(names)/(length(names))
end
Percentageoftimein_mc = PercentageoftimeinMClow+PercentageoftimeinMCup ;
But I keep getting this error when I try:
% File: plot_smolts.m Line: 91 Column: 9
% Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other
% syntax error. To construct matrices, use brackets instead of parentheses.
Not sure how I should go about doing this. strings, for loop MATLAB Answers — New Questions
Reporting Authentication Method Usage Data via the Graph
New Summary Methods for Entra ID Authentication Methods
Three new Entra ID Graph resources are available in the authentication methods usage reports API to help track adoption of authentication methods, especially the progress towards usage of strong authentication methods for multifactor authentication. It’s easy enough to create a report detailing the authentication methods in use with PowerShell. These resources deliver summary information in a very accessible manner, providing that you have the necessary Entra P1 or P2 licenses needed to access report data via the Graph.
Microsoft doesn’t add to the Graph without good reason. In this case, it’s likely that these resources and methods will be used for reporting in the Entra admin center. Microsoft Graph PowerShell SDK cmdlets aren’t available for the APIs yet, so the examples below use the Invoke-MgGraphRequest cmdlet to run requests. Like all Entra ID sign-in data, information is available for the last 30 days. To run the requests, the Graph SDK session needs the AuditLog.Read.All permission and the signed-in user must hold one of the roles specified in the documentation like Reports Reader or Security Administrator.
User Events Summary
The userEventsSummary resource provides a list of events associated with user activities to register an authentication method or reset using SSPR. The method supports several different filters to allow events to be found based on user principal name, display name, success or failure, and authentication method. Here’s an example which looks for every matching event that’s available. Only one event is available in my tenant, where a user set up SMS as a secondary authentication method. This isn’t a strong authentication method and the user deserves to be nagged to use a stronger method, like the Microsoft authenticator app.
$Uri = 'https://graph.microsoft.com/beta/reports/authenticationMethods/userEventsSummary' [array]$Data = Invoke-MgGraphRequest -Uri $Uri -Method GET -OutputType PSObject | Select-Object -ExpandProperty Value $Data id : d93bdb0a-8cb7-4303-a8ef-48c488997c38 feature : registration userPrincipalName : John.Jameson@office365itpros.com userDisplayName : John Jameson isSuccess : True authMethod : sms failureReason : eventDateTime : 01/08/2025 12:35:30
User Registration Method Summary
The userRegistrationMethodSummary resource is a summary of the number of users registered for each authentication method. To access the summary, run the request as follows:
$Uri = "https://graph.microsoft.com/beta/reports/authenticationMethods/usersRegisteredByMethod(includedUserTypes='all',includedUserRoles='all')" [array]$data = Invoke-MgGraphRequest -Uri $Uri -Method Get -OutputType PSObject | Select-Object -ExpandProperty userRegistrationMethodCounts $Data authenticationMethod userCount -------------------- --------- password 0 email 11 mobilePhone 126 alternateMobilePhone 0 officePhone 0 microsoftAuthenticatorPush 115 softwareOneTimePasscode 15 hardwareOneTimePasscode 0 microsoftAuthenticatorPasswordless 2 windowsHelloForBusiness 1 fido2SecurityKey 0 temporaryAccessPass 0 securityQuestion 0 macOsSecureEnclaveKey 0 passKeyDeviceBound 1 passKeyDeviceBoundAuthenticator 1 passKeyDeviceBoundWindowsHello 0 externalAuthMethod 0
User MFA Sign-In Summary
The userMfaSignInSummary list method is the one that interested me the most. Essentially, the report gives a daily sign-in report for 30 days detailing the total sign-ins and the number for MFA and single-factor sign-ins. A record looks like this:
id : f7c6b675-e664-44dc-9523-947501b0fac6 createdDateTime : 15/07/2025 00:00:00 totalSignIns : 59 singleFactorSignIns : 17 multiFactorSignIns : 42
I used the report to interrogate the sign-in audit log for days when single-factor sign-ins occurred to discover which accounts and apps are involved. The command used to find single-factor sign-ins for a day looks like this (the beta cmdlet is used because the V1.0 cmdlet doesn’t currently return the authentication requirement):
[array]$SignInRecords = Get-MgBetaAuditLogSignIn -Filter "createdDateTime gt $StartDate and createdDateTime lt $EndDate and AuthenticationRequirement eq 'singleFactorAuthentication' and status/errorCode eq 0" -Sort "createdDateTime DESC"
Figure 1 shows the report output. The idea is that administrators can use this information to figure out why single-factor authentications still happen. Most of the accounts highlighted by the report are guest accounts that don’t use MFA because I disabled the conditional access policy to enforce MFA for guest accounts.

You can download the full script from the Office 365 for IT Pros GitHub repository.
Looking for Usage
Any API is only useful if it has a purpose. Hopefully, these notes spark some ideas for how to use the report data in campaigns to improve multifactor adoption within Microsoft 365 tenants. At least, that’s the general idea…
Insight like this doesn’t come easily. You’ve got to know the technology and understand how to look behind the scenes. Benefit from the knowledge and experience of the Office 365 for IT Pros team by subscribing to the best eBook covering Office 365 and the wider Microsoft 365 ecosystem.
how to control the BackgroundAlpha of the text box
Is there a way to create a text box with BackgroundAlpha (such as 0.5)? I can’t find the alpha option for text box background in Text Properties.Is there a way to create a text box with BackgroundAlpha (such as 0.5)? I can’t find the alpha option for text box background in Text Properties. Is there a way to create a text box with BackgroundAlpha (such as 0.5)? I can’t find the alpha option for text box background in Text Properties. text MATLAB Answers — New Questions
Modelling a Pressure Regulator in Simscape
Hi, I am trying to model a pressure regulator in simspace, but I could not manage to connect mechanical system to fluid system. I used single acting actuator and connect it to matlab function that has a function form all the "to workspace" blocks how can I fix the system I attached the picture of the systems.
% Compute spring force (negative due to opposing motion)
F_spring = -x * (k1 + k2) + F_preload;
% Compute pressure forces
F_pressure = P_out * A_outlet + P_atm * A_atm – P_sen * A_sen – P_in * A_inlet;
% Compute friction force
F_piston = mu * A_pis * P_sen;
F_poppet = mu * A_pop * P_in;
F_friction = sign(v) * (F_piston + F_poppet);
% Net force (sum of spring, pressure, and friction forces)
F_net = F_spring + F_pressure – F_friction;
% Note: m_tot * x_ddot = F_net should be solved externally (e.g., in Simulink)
endHi, I am trying to model a pressure regulator in simspace, but I could not manage to connect mechanical system to fluid system. I used single acting actuator and connect it to matlab function that has a function form all the "to workspace" blocks how can I fix the system I attached the picture of the systems.
% Compute spring force (negative due to opposing motion)
F_spring = -x * (k1 + k2) + F_preload;
% Compute pressure forces
F_pressure = P_out * A_outlet + P_atm * A_atm – P_sen * A_sen – P_in * A_inlet;
% Compute friction force
F_piston = mu * A_pis * P_sen;
F_poppet = mu * A_pop * P_in;
F_friction = sign(v) * (F_piston + F_poppet);
% Net force (sum of spring, pressure, and friction forces)
F_net = F_spring + F_pressure – F_friction;
% Note: m_tot * x_ddot = F_net should be solved externally (e.g., in Simulink)
end Hi, I am trying to model a pressure regulator in simspace, but I could not manage to connect mechanical system to fluid system. I used single acting actuator and connect it to matlab function that has a function form all the "to workspace" blocks how can I fix the system I attached the picture of the systems.
% Compute spring force (negative due to opposing motion)
F_spring = -x * (k1 + k2) + F_preload;
% Compute pressure forces
F_pressure = P_out * A_outlet + P_atm * A_atm – P_sen * A_sen – P_in * A_inlet;
% Compute friction force
F_piston = mu * A_pis * P_sen;
F_poppet = mu * A_pop * P_in;
F_friction = sign(v) * (F_piston + F_poppet);
% Net force (sum of spring, pressure, and friction forces)
F_net = F_spring + F_pressure – F_friction;
% Note: m_tot * x_ddot = F_net should be solved externally (e.g., in Simulink)
end simulink, simscape MATLAB Answers — New Questions
save a cmyk image in jpeg
hi
i would like to save a cmyk image in jpeg
thanks!hi
i would like to save a cmyk image in jpeg
thanks! hi
i would like to save a cmyk image in jpeg
thanks! cmyk image, jpeg MATLAB Answers — New Questions
How can I pass a tunable struct parameter as an input to the generated step function in Embedded Coder for a Simulink model using reusable function packaging?
Hello MathWorks team,
I have a Simulink model named experiment_demo.slx that includes a MATLAB Function block with the following code:
function adjusted_setpoint = fcn(setpoint, cfg)
adjusted_setpoint = setpoint * cfg.gain * cfg.offset;
setpoint is provided via an Inport.
cfg is a tunable parameter defined as a Simulink.Parameter with a Bus type (ModelConfigBus) and configured via the Model Explorer.
Model configuration:
Solver: Fixed-step
Code Generation:
System target file: ert.tlc
Code interface packaging: Reusable function
Code is generated using Embedded Coder. In the generated code:
The ModelConfigBus struct is defined in experiment_demo_types.h as:
typedef struct {
real_T gain;
real_T offset;
} ModelConfigBus;
My goal is to pass the cfg parameter directly into the generated experiment_demo_step() function, so that it can be configured from an external source (e.g., another module or application). Ideally, I would like the struct to be declared in experiment_demo.h and used as an input argument in experiment_demo.c.
Questions:
What is the recommended way to expose a tunable struct parameter like cfg as an input to the step() function in the generated code?
Is there a configuration or customization (e.g., via code interface settings or TLC customization) that allows this struct to be passed explicitly to the step function?
Would moving the struct definition from experiment_demo_types.h to experiment_demo.h be supported or recommended for this use case?
Thank you!Hello MathWorks team,
I have a Simulink model named experiment_demo.slx that includes a MATLAB Function block with the following code:
function adjusted_setpoint = fcn(setpoint, cfg)
adjusted_setpoint = setpoint * cfg.gain * cfg.offset;
setpoint is provided via an Inport.
cfg is a tunable parameter defined as a Simulink.Parameter with a Bus type (ModelConfigBus) and configured via the Model Explorer.
Model configuration:
Solver: Fixed-step
Code Generation:
System target file: ert.tlc
Code interface packaging: Reusable function
Code is generated using Embedded Coder. In the generated code:
The ModelConfigBus struct is defined in experiment_demo_types.h as:
typedef struct {
real_T gain;
real_T offset;
} ModelConfigBus;
My goal is to pass the cfg parameter directly into the generated experiment_demo_step() function, so that it can be configured from an external source (e.g., another module or application). Ideally, I would like the struct to be declared in experiment_demo.h and used as an input argument in experiment_demo.c.
Questions:
What is the recommended way to expose a tunable struct parameter like cfg as an input to the step() function in the generated code?
Is there a configuration or customization (e.g., via code interface settings or TLC customization) that allows this struct to be passed explicitly to the step function?
Would moving the struct definition from experiment_demo_types.h to experiment_demo.h be supported or recommended for this use case?
Thank you! Hello MathWorks team,
I have a Simulink model named experiment_demo.slx that includes a MATLAB Function block with the following code:
function adjusted_setpoint = fcn(setpoint, cfg)
adjusted_setpoint = setpoint * cfg.gain * cfg.offset;
setpoint is provided via an Inport.
cfg is a tunable parameter defined as a Simulink.Parameter with a Bus type (ModelConfigBus) and configured via the Model Explorer.
Model configuration:
Solver: Fixed-step
Code Generation:
System target file: ert.tlc
Code interface packaging: Reusable function
Code is generated using Embedded Coder. In the generated code:
The ModelConfigBus struct is defined in experiment_demo_types.h as:
typedef struct {
real_T gain;
real_T offset;
} ModelConfigBus;
My goal is to pass the cfg parameter directly into the generated experiment_demo_step() function, so that it can be configured from an external source (e.g., another module or application). Ideally, I would like the struct to be declared in experiment_demo.h and used as an input argument in experiment_demo.c.
Questions:
What is the recommended way to expose a tunable struct parameter like cfg as an input to the step() function in the generated code?
Is there a configuration or customization (e.g., via code interface settings or TLC customization) that allows this struct to be passed explicitly to the step function?
Would moving the struct definition from experiment_demo_types.h to experiment_demo.h be supported or recommended for this use case?
Thank you! simulink, embeddedcoder, reusablefunction MATLAB Answers — New Questions
Multiple Instances of MATLAB operating on Simulink Data Dictionaries can lead to crash or errors “database slddc is locked”
I am running multiple MATLAB instance on my machine that operate on Simulink Data Dictionaries. This could be either:Multiple MATLAB’s started at the same time by calling the matlab executable in a batch or similar script. Multiple MATLAB workers using parfeval, parfor, etc and doing Simulink Data Dictionary operations on these workers.
In some cases I get this error:
The database \?C:UsersrspenceAppDataLocalTempdata_model_repository3.4_R2023b_v1_rspence.slddc is locked, or a table in the database is locked. (database is locked)
In other cases I get a MATLAB Crash where the stacktrace points to something in Simulink Data Dictionary.
What could be the cause?I am running multiple MATLAB instance on my machine that operate on Simulink Data Dictionaries. This could be either:Multiple MATLAB’s started at the same time by calling the matlab executable in a batch or similar script. Multiple MATLAB workers using parfeval, parfor, etc and doing Simulink Data Dictionary operations on these workers.
In some cases I get this error:
The database \?C:UsersrspenceAppDataLocalTempdata_model_repository3.4_R2023b_v1_rspence.slddc is locked, or a table in the database is locked. (database is locked)
In other cases I get a MATLAB Crash where the stacktrace points to something in Simulink Data Dictionary.
What could be the cause? I am running multiple MATLAB instance on my machine that operate on Simulink Data Dictionaries. This could be either:Multiple MATLAB’s started at the same time by calling the matlab executable in a batch or similar script. Multiple MATLAB workers using parfeval, parfor, etc and doing Simulink Data Dictionary operations on these workers.
In some cases I get this error:
The database \?C:UsersrspenceAppDataLocalTempdata_model_repository3.4_R2023b_v1_rspence.slddc is locked, or a table in the database is locked. (database is locked)
In other cases I get a MATLAB Crash where the stacktrace points to something in Simulink Data Dictionary.
What could be the cause? MATLAB Answers — New Questions
Removing Obsolete Mobile Device Partnerships from Exchange Online
Cleaning Up Obsolete Mobile Devices is Always a Good Idea
After publishing the article about the removal of mobile device management settings for users from OWA and the new Outlook, I was contacted by several people to ask should they clean up the obsolete devices that exist for so many mailboxes.
Generally speaking, I am all for removing clutter. Cleaning out unwanted data is a good thing. Just ask any of the Copilot tenants who struggle with digital debris (old, unwanted, inaccurate, and misleading information stored in Microsoft 365) that corrupt Copilot responses to user prompts. Removing some old device partnerships is not in the same category as cleaning up a bunch of old files from SharePoint Online and OneDrive for Business, but the same principle applies.
Mobile Device Partnerships with Mailboxes
When a mobile device begins to synchronize information from Exchange Online, it creates a partnership between the device and the target mailbox. The Get-MobileDevice cmdlet lists active partnerships. If you run the cmdlet without any parameters, it returns all the partnerships in the tenant. That’s not a great idea in anything other than a demo tenant, but I’ve seen people advising others that this is the way to go.
It’s better to run Get-MobileDevice to check the partnerships for a mailbox (which is what happens to populate the set of devices shown by OWA and the new Outlook). This is the command I use:
[array]$Devices = Get-MobileDevice -Mailbox James.Ryan@office365itpros.com
The information returned by the cmdlet reveals a lot about the device. Here’s a snippet:
FriendlyName : DeviceId : C05A87A5DE4F468DA2399763634D4686 DeviceImei : DeviceMobileOperator : DeviceOS : iOS 18.6 22G86 DeviceOSLanguage : DeviceTelephoneNumber : DeviceType : Outlook DeviceUserAgent : Outlook-iOS/2.0 DeviceModel : Outlook for iOS and Android FirstSyncTime : 14/12/2022 17:01:58 UserDisplayName : Tony Redmond DeviceAccessState : Allowed DeviceAccessStateReason : DeviceRule DeviceAccessControlRule : Outlook for iOS and Android (DeviceModel) ClientVersion : 1.0 ClientType : Outlook
Some properties don’t have values. While I can’t be certain why this is so, it’s likely because of the changing focus within Microsoft to device management. Intune is the preferred solution now, so Exchange mobile device management is limited to what’s needed for Exchange and devices to synchronize. However, there’s enough here to confirm that it is an iOS device running Outlook for iOS and that the user first connected the device to their mailbox in December 2022.
Getting Device Statistics
What’s missing from the partnership information is any indication of activity. That information comes from the Get-ExoMobileDeviceStatistics cmdlet (use Get-MobileDeviceStatistics for on-premises mailboxes). Device statistics show the last time the device synchronized with the mailbox:
LastPolicyUpdateTime : 15/08/2025 02:52:24 LastSuccessSync : 15/08/2025 10:32:27 LastSyncAttemptTime : 15/08/2025 10:32:27 MailboxLogReport : NumberOfFoldersSynced : 0 Status : DeviceOk
Again, there are many properties that are not populated or don’t contain useful information. For instance, the Status property reflects the state of the device as known to Exchange the last time synchronization occurred. The device could be lost, stolen, or wrecked. The important property is LastSuccessSync, the timestamp for the last successful synchronization. It’s reasonable to use the timestamp as an indicator of activity. If a device hasn’t synchronized in a year (or less), it’s likely an obsolete mobile device. In many cases, people replace devices and never remove the old device, leaving an accumulation of obsolete devices to build up.
Cleaning up the Mess with PowerShell
When users don’t clean up, it’s up to administrators to swing into action. Some PowerShell will do the trick. To illustrate the point, I wrote a script (downloadable from the Office 365 for IT Pros GitHub repository) that:
- Finds all user mailboxes.
- Checks each mailbox for device partnerships.
- Checks each device for the last synchronization time.
- If the device hasn’t synchronized in over a year (customizable threshold), note it as an obsolete device.
- Report what’s been found and ask the administrator if the obsolete devices should be removed. As you can see from Figure 1, some of the devices haven’t synchronized in years. The entry for Outlook for Mac is there because that client uses Microsoft synchronization technology to fetch information from Exchange Online, just like Outlook for iOS and Android do.
- Clean up the old devices with the Remove-MobileDevice cmdlet.

The script isn’t very complicated and took less than an hour to write in front of the TV (my excuse for any errors). Feel free to amend the code to suit your purposes. The script should run with on-premises Exchange if you replace Get-ExoMailbox with Get-Mailbox and Get-ExoMobileDeviceStatistics with Get-MobileDeviceStatistics.
Need some assistance to write and manage PowerShell scripts for Microsoft 365? Get a copy of the Automating Microsoft 365 with PowerShell eBook, available standalone or as part of the Office 365 for IT Pros eBook bundle.