Author: PuTI
Why does an error message appear when clicking a requirement link created using “Link to Selected Requirement” in Test Manager?
I see an error message when I click a requirement link created using "Link to Selected Requirement" in Test Manager.
Error "File not found: ./requirement/z.slreqx (channel: "Test/OpenReqLink")"I see an error message when I click a requirement link created using "Link to Selected Requirement" in Test Manager.
Error "File not found: ./requirement/z.slreqx (channel: "Test/OpenReqLink")" I see an error message when I click a requirement link created using "Link to Selected Requirement" in Test Manager.
Error "File not found: ./requirement/z.slreqx (channel: "Test/OpenReqLink")" to, "test, manager", "how, use" MATLAB Answers — New Questions
Why do I receive the error “Something went wrong preparing your license for use.”?
1) When accessing MATLAB Online after signing in through my Campus portal page, I receive a message stating "Something went wrong preparing your license for use." If I try to access MATLAB Online directly through matlab.mathworks.com, the message I receive is, "Your MathWorks account is not linked to an active license."
2) When starting a 30 day trial for MATLAB, I receive an error message stating "Something went wrong preparing your license for use".1) When accessing MATLAB Online after signing in through my Campus portal page, I receive a message stating "Something went wrong preparing your license for use." If I try to access MATLAB Online directly through matlab.mathworks.com, the message I receive is, "Your MathWorks account is not linked to an active license."
2) When starting a 30 day trial for MATLAB, I receive an error message stating "Something went wrong preparing your license for use". 1) When accessing MATLAB Online after signing in through my Campus portal page, I receive a message stating "Something went wrong preparing your license for use." If I try to access MATLAB Online directly through matlab.mathworks.com, the message I receive is, "Your MathWorks account is not linked to an active license."
2) When starting a 30 day trial for MATLAB, I receive an error message stating "Something went wrong preparing your license for use". MATLAB Answers — New Questions
Polyspace Code Prover incremental/delta analysis
Hi,
is there an option to run Polyspace Code Prover only for changes since the last baseline/commit (basically for files that only changed since the last baseline/commit) ?
This would be crucial to decrease analysis time.
The only adjusting screws for analysis time I know are precision level (-O0, -O1 etc.), verification level (pass0, pass1 etc.) and CPU core count (max-processes option).
We set up PSCP for now locally but the goal is to run it in the CI pipeline and shorter pipeline runs are of course preferred.Hi,
is there an option to run Polyspace Code Prover only for changes since the last baseline/commit (basically for files that only changed since the last baseline/commit) ?
This would be crucial to decrease analysis time.
The only adjusting screws for analysis time I know are precision level (-O0, -O1 etc.), verification level (pass0, pass1 etc.) and CPU core count (max-processes option).
We set up PSCP for now locally but the goal is to run it in the CI pipeline and shorter pipeline runs are of course preferred. Hi,
is there an option to run Polyspace Code Prover only for changes since the last baseline/commit (basically for files that only changed since the last baseline/commit) ?
This would be crucial to decrease analysis time.
The only adjusting screws for analysis time I know are precision level (-O0, -O1 etc.), verification level (pass0, pass1 etc.) and CPU core count (max-processes option).
We set up PSCP for now locally but the goal is to run it in the CI pipeline and shorter pipeline runs are of course preferred. polyspace, polyspace code prover, incremental MATLAB Answers — New Questions
Tenable Vulnerability CVS-2026-34480
Is MATLAB R2024a vulnerable to CVE-2026-34480, and is there a security advisory or patch available? The Tenable scanner in our air gapped environment flags this finding as a High vulnerability, so we need to either patch or have something from the vendor we can present to our cybersecurity team. At this time, we cannot upgrade our Matlab version so if there is no patch, we will need to POAM. Thanks!Is MATLAB R2024a vulnerable to CVE-2026-34480, and is there a security advisory or patch available? The Tenable scanner in our air gapped environment flags this finding as a High vulnerability, so we need to either patch or have something from the vendor we can present to our cybersecurity team. At this time, we cannot upgrade our Matlab version so if there is no patch, we will need to POAM. Thanks! Is MATLAB R2024a vulnerable to CVE-2026-34480, and is there a security advisory or patch available? The Tenable scanner in our air gapped environment flags this finding as a High vulnerability, so we need to either patch or have something from the vendor we can present to our cybersecurity team. At this time, we cannot upgrade our Matlab version so if there is no patch, we will need to POAM. Thanks! cvs-2026-34480 MATLAB Answers — New Questions
List all memoized function caches
I know that clearAllMemoizedCaches will clear all memoized function data, but what if I just want to list all existing memoized caches (and maybe also their cache stats). Is there a way to do that?I know that clearAllMemoizedCaches will clear all memoized function data, but what if I just want to list all existing memoized caches (and maybe also their cache stats). Is there a way to do that? I know that clearAllMemoizedCaches will clear all memoized function data, but what if I just want to list all existing memoized caches (and maybe also their cache stats). Is there a way to do that? memoize MATLAB Answers — New Questions
What’s the Best Way to Convert a .mat File from -v4 format to -v7 Format?
Is there a better way than reading all of the data from the -v4 .mat file and then saving all of the data to a -v7?
data = load(‘v4matfile.mat’);
save("v7matfile.mat","-struct","data","-v7");Is there a better way than reading all of the data from the -v4 .mat file and then saving all of the data to a -v7?
data = load(‘v4matfile.mat’);
save("v7matfile.mat","-struct","data","-v7"); Is there a better way than reading all of the data from the -v4 .mat file and then saving all of the data to a -v7?
data = load(‘v4matfile.mat’);
save("v7matfile.mat","-struct","data","-v7"); save, -v4, -v7 MATLAB Answers — New Questions
Make memoized function calls independent of Name/Value argument ordering
In the demo below, we see that the memoized function func() executes twice out of the three times it is called. Ideally, it would only execute upon the first call, but the memoization engine fails to recognize that (1) and (2) are equivalent calls. Is there any way to get a memoized function to ignore differences in the ordering of Name/Value arguments?
mf=memoize(@func);
mf(‘A’,1,’B’,2) %(1) Cached
mf(‘B’,2,’A’,1) %(2) Cached
mf(‘A’,1,’B’,2) %(3) Not Cached
function func(opts)
arguments
opts.A
opts.B
end
disp("Executing")
endIn the demo below, we see that the memoized function func() executes twice out of the three times it is called. Ideally, it would only execute upon the first call, but the memoization engine fails to recognize that (1) and (2) are equivalent calls. Is there any way to get a memoized function to ignore differences in the ordering of Name/Value arguments?
mf=memoize(@func);
mf(‘A’,1,’B’,2) %(1) Cached
mf(‘B’,2,’A’,1) %(2) Cached
mf(‘A’,1,’B’,2) %(3) Not Cached
function func(opts)
arguments
opts.A
opts.B
end
disp("Executing")
end In the demo below, we see that the memoized function func() executes twice out of the three times it is called. Ideally, it would only execute upon the first call, but the memoization engine fails to recognize that (1) and (2) are equivalent calls. Is there any way to get a memoized function to ignore differences in the ordering of Name/Value arguments?
mf=memoize(@func);
mf(‘A’,1,’B’,2) %(1) Cached
mf(‘B’,2,’A’,1) %(2) Cached
mf(‘A’,1,’B’,2) %(3) Not Cached
function func(opts)
arguments
opts.A
opts.B
end
disp("Executing")
end memoize, name/value MATLAB Answers — New Questions
Achieving success with AI
The two most important elements in any AI solution are Intelligence + Trust. I first made this statement in November at our Ignite conference and my conviction is strengthened by every conversation I have with customers. Through my travels, three consistent topics are being raised when considering the adoption of AI solutions:
- Will AI amplify the intelligence of my organization and the attributes that make my company unique within its industry to grow my business; or will it use my intelligence for its own benefit, learning from my most important business flows and leveraging my intellectual property?
- Can I trust that the outcomes are providing durable return on investment and that these solutions are running within the confines of my governance and security standards?
- How do I get the visibility, control, flexibility and business model innovation needed to manage the costs associated with AI and maximize value?
I consistently advise customers that they need to build their own IQ on a platform of intelligence that is model-diverse, open and heterogeneous at every layer of the stack. Models are commoditizing. No company should be dependent upon any one model or any one model’s harness. Over the weekend, Satya warned of a world where every company across every sector is ceding value to a few models that eat everything they see. AI that is intended for growth should amplify the intelligence of an organization so that it compounds from within.
Companies also need an observability platform that provides governance, management, security and Financial Operations (FinOps) to ensure the ROI with AI. This enables AI to be trusted within the environment over which it reasons and puts the business in control of the outcomes.
Intelligence + Trust is embedded across Microsoft 365 Copilot, GitHub Copilot and Copilot Studio, where model diversity aligns cost and performance to each task. Microsoft IQ optimizes workflows, so context is routed efficiently and reduces unnecessary compute. Agent 365 is the control plane to observe, govern, manage and secure agents. We have built a system to manage AI spend as a core enterprise capability, not an afterthought. It is delivered across clouds and model providers without locking customers into a single approach.
Managing costs at scale
As agent usage scales, organizations need a clear set of levers to manage cost:
Model diversity. Any given inferencing model, model harness or agentic loop on its own does not help build out an organization’s IQ in ways that compound its intelligence. Both Microsoft 365 Copilot and GitHub Copilot are model-diverse by design without locking customers into a single provider. Different models — like GPT-5.5 or Claude Opus 4.8 — serve distinct roles with different economics. Matching the right intelligence to each task optimizes performance and cost.
Your IQ. Agents struggle with raw data. Significant compute is spent interpreting structure and context before useful work begins. The Microsoft IQ platform empowers your IQ by turning raw data into usable intelligence, continuously building a semantic understanding of how your organization operates across Microsoft 365 and line-of-business systems. It provides agents with the context they need upfront rather than requiring them to reconstruct it. The result is measurable: faster execution, higher accuracy and lower token usage. This is how intelligence compounds within your organization.
Financial operations. FinOps became critical when companies moved to the cloud and requires even greater attention as AI shifts from fixed pricing to usage-driven models. With Foundry and Agent 365, we are providing tools to help our customers optimize their AI costs today.
Frontier business models
Business models are evolving as we use AI to drive business outcomes. The User Subscription License (USL) has become the foundation, providing a package of capabilities for a predictable per-user-per-month fee. Usage-based licensing has emerged for long-running, multi-tasking agents, where cost aligns directly to the work performed.
Microsoft gives customers a unique combination of business model flexibility and integrated product experiences that is unmatched in the market. Microsoft 365 Copilot and GitHub Copilot use both models — a USL offering with not only value and capabilities, but flexible consumption on top. Today we’re announcing the general availability of Copilot Cowork worldwide, which requires the Microsoft 365 Copilot USL and is then usage-based.
Our model-diverse strategy allows customers to purchase capacity with the flexibility to use the right model for the job based on model strengths, economics and the latest innovations. Microsoft Agent Factory provides a single consumption model spanning Microsoft 365 Copilot (including Cowork), GitHub Copilot and agents built in Fabric, Foundry and Copilot Studio.
Our integrated product experiences put AI in the flow of work for both knowledge workers and software developers and manage capacity fluidly across the two. Historically these personas have been distinct, but increasingly the line between them is blurring. Coding is becoming a mainstream knowledge worker skill and chat and Cowork are becoming modalities important for software development. With Microsoft 365 and GitHub, we offer market-leading tools for both roles and make it easy to seamlessly manage capacity based on availability and need.
Agent 365: The control plane
As organizations adopt agents from Microsoft, another provider or build their own, a control plane is essential. Agent 365 gives IT and security leaders a single place to observe, govern, manage and secure agents across the organization. It builds on the Microsoft stack that enterprises trust: Entra for identity, Defender for threat protection, Purview for data governance and Intune for endpoint management. We are extending Agent 365 to include cost management, so organizations can monitor and manage agent spend alongside security and compliance. As the Frontier Firm operating model takes hold, leaders will manage human and agentic work as a single system, with visibility into both performance and cost.
—
The two most essential elements in any AI solution are Intelligence + Trust. At Microsoft, this conviction shapes how we design every layer of our AI platform. Microsoft IQ enables organizations to harness their own unique IQ, bringing context to data and embedding AI directly into the flow of work to deliver faster, more accurate and more trusted outcomes while safeguarding assets and protecting intellectual property. Agent 365 provides that trust layer, ensuring every agent and AI artifact is observed across the environment so organizations can move decisively from experimentation to enterprise impact with confidence. As Jay Parikh put it at Build, AI alone will not change your business. The system running it will.
We have built this system for our customers and partners, where intelligence compounds from within and every agent operates with control, visibility and trust. Together, we can scale human ambition and define how AI delivers measurable business impact across every role, organization and industry.
Judson Althoff is the chief executive officer of the commercial business at Microsoft. He is responsible for the product strategy, sales, services, support, marketing, operations and revenue growth of the company’s commercial business, which operates in more than 120 regional and national subsidiaries globally.
The post Achieving success with AI appeared first on The Official Microsoft Blog.
The two most important elements in any AI solution are Intelligence + Trust. I first made this statement in November at our Ignite conference and my conviction is strengthened by every conversation I have with customers. Through my travels, three consistent topics are being raised when considering the adoption of AI solutions: Will AI amplify…
The post Achieving success with AI appeared first on The Official Microsoft Blog.Read More
Getting wrong output when Modelling a VFD powered by a generator, feeding a motor
Hello Everyone, I am trying to model an VFD which is powered by an AC Generator, feeding an induction motor. I got a model online, where the guy takes a pure DC supply as the source. I modified his model, replacing it with AC Supply and a rectifier. The model works well with DC supply, however it gives wrong output when a AC Generator with a rectifier is connected.
Below is the model powered by a DC source, this works perfectly.
Below is the model with AC source, this gives wierd outputs.
This is the voltage produced by rectifier
This is the Voltage Produced by invertor
Below is the motor torque and rpm
I would really appreciate if someone can help me figure out what is wrong in my system, Thanks.Hello Everyone, I am trying to model an VFD which is powered by an AC Generator, feeding an induction motor. I got a model online, where the guy takes a pure DC supply as the source. I modified his model, replacing it with AC Supply and a rectifier. The model works well with DC supply, however it gives wrong output when a AC Generator with a rectifier is connected.
Below is the model powered by a DC source, this works perfectly.
Below is the model with AC source, this gives wierd outputs.
This is the voltage produced by rectifier
This is the Voltage Produced by invertor
Below is the motor torque and rpm
I would really appreciate if someone can help me figure out what is wrong in my system, Thanks. Hello Everyone, I am trying to model an VFD which is powered by an AC Generator, feeding an induction motor. I got a model online, where the guy takes a pure DC supply as the source. I modified his model, replacing it with AC Supply and a rectifier. The model works well with DC supply, however it gives wrong output when a AC Generator with a rectifier is connected.
Below is the model powered by a DC source, this works perfectly.
Below is the model with AC source, this gives wierd outputs.
This is the voltage produced by rectifier
This is the Voltage Produced by invertor
Below is the motor torque and rpm
I would really appreciate if someone can help me figure out what is wrong in my system, Thanks. motor, generator, specialized power systems, sps MATLAB Answers — New Questions
reading text and reformatting for excel
Another member of my team has created a modelling programme which outputs data that looks like this:
Train MWh consumed MWh regen V_av. Umean_tr Min V @ km Max V Max Delay(s) @ station
01_02_01 0.2498 -0.0209 1.5755 1.474 1.1937 0.027523 1.8
01_02_02 0.2496 -0.0259 1.5717 1.4722 1.1937 0.027523 1.7963
01_02_03 0.2496 -0.0277 1.569 1.4723 1.1937 0.027523 1.7963
01_02_04 0.2494 -0.0299 1.5628 1.4614 1.1938 0.027523 1.798
01_02_05 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_06 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_07 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_08 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_09 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_10 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_11 0.2497 -0.0296 1.5629 1.4621 1.1941 0.027523 1.7985
01_02_12 0.2497 -0.0272 1.5691 1.4646 1.1941 0.027523 1.8
I want to read the ‘table’ and reformat it into excel. Is that likely to be simple or should I delve into the depths of his programme and print them to the excel sheet directly?Another member of my team has created a modelling programme which outputs data that looks like this:
Train MWh consumed MWh regen V_av. Umean_tr Min V @ km Max V Max Delay(s) @ station
01_02_01 0.2498 -0.0209 1.5755 1.474 1.1937 0.027523 1.8
01_02_02 0.2496 -0.0259 1.5717 1.4722 1.1937 0.027523 1.7963
01_02_03 0.2496 -0.0277 1.569 1.4723 1.1937 0.027523 1.7963
01_02_04 0.2494 -0.0299 1.5628 1.4614 1.1938 0.027523 1.798
01_02_05 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_06 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_07 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_08 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_09 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_10 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_11 0.2497 -0.0296 1.5629 1.4621 1.1941 0.027523 1.7985
01_02_12 0.2497 -0.0272 1.5691 1.4646 1.1941 0.027523 1.8
I want to read the ‘table’ and reformat it into excel. Is that likely to be simple or should I delve into the depths of his programme and print them to the excel sheet directly? Another member of my team has created a modelling programme which outputs data that looks like this:
Train MWh consumed MWh regen V_av. Umean_tr Min V @ km Max V Max Delay(s) @ station
01_02_01 0.2498 -0.0209 1.5755 1.474 1.1937 0.027523 1.8
01_02_02 0.2496 -0.0259 1.5717 1.4722 1.1937 0.027523 1.7963
01_02_03 0.2496 -0.0277 1.569 1.4723 1.1937 0.027523 1.7963
01_02_04 0.2494 -0.0299 1.5628 1.4614 1.1938 0.027523 1.798
01_02_05 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_06 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_07 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_08 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_09 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_10 0.2497 -0.0299 1.5628 1.4621 1.1941 0.027523 1.7974
01_02_11 0.2497 -0.0296 1.5629 1.4621 1.1941 0.027523 1.7985
01_02_12 0.2497 -0.0272 1.5691 1.4646 1.1941 0.027523 1.8
I want to read the ‘table’ and reformat it into excel. Is that likely to be simple or should I delve into the depths of his programme and print them to the excel sheet directly? text file, excel, export, output, matrix, strings MATLAB Answers — New Questions
Likely error when doing high dimensional permute of big gpu array
The following code reproduces what appears to be an error when using permute, specifically I permute a matrix contains all positive integers, but the permute output contains zeros.
To trigger the error seems to require three things:
(i) big, say >4gb, array (does not trigger on 3.5gb array)
(ii) gpu array (does not trigger for cpu array)
(iii) high dimensional permute (triggers with 6D, but not 2D)
Following is code to reproduce the issue, and below that a copy-paste of what is printed to command window.
[I use Matlab R2025b, my gpu is detailed in the output.]
%% permutetest.m
% There is an error when permuting BIG GPU arrays with HIGH dimensions.
%
% 1. Doing a permute on a 6D gpu array that is big (roughly >4gb) GIVES ERRORS, specifically this is the ‘Case 1’ below.
% The error is that many elements get replaced with zeros.
%
% 2. Doing the same, but on a smaller (<4gb) gpu array does not error (Case 2 below)
% 3. Redoing first two cases, but on the cpu does not error (Cases 3 and 4)
% 4. Redoing first two cases, but only having permute across 2D does not error (Cases 5 and 6).
%
% The matices being permuted contain integers between 1 and 100, so seems
% unlikely that the actual contents are relevant to the error but I have
% not attempted to test this.
clear all
disp(gpuDevice) % show GPU model + available memory
% Sizes via [4, X, 15, 5, 3, 100]: elements = 90000*X, bytes(double) = 720000*X.
Xmid = 5220; % 469,800,000 elems = 3,758,400,000 bytes = 3.500 GiB (~3.5 GB)
Xhigh = 5966; % 536,940,000 elems = 4,295,520,000 bytes = 4.000 GiB (just above 4 GB)
% mode ‘6D’ => permute(A,[1,2,4,5,3,6]) on the array as-is
% mode ‘2D’ => reshape A to a 2-D matrix [4*X, 22500] then permute(A,[2,1])
%%
cases = {
‘~4.0 GB, GPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘6D’; % big, gpu, high dim
‘~3.5 GB, GPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘gpu’, ‘6D’; % small, gpu, high dim
‘~4.0 GB, CPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘cpu’, ‘6D’; % big, cpu, high dim
‘~3.5 GB, CPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘cpu’, ‘6D’; % small, cpu, high dim
‘~4.0 GB, GPU, 2-D transpose’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘2D’; % big, gpu, low dim
‘~3.5 GB, GPU, 2-D transpose’, [4 Xmid 15 5 3 100], ‘gpu’, ‘2D’; % small, gpu, low dim
};
%% Do each case and give feedback on results
for ii=1:size(cases,1)
label = cases{ii,1}; sz = cases{ii,2}; dev = cases{ii,3}; mode = cases{ii,4};
% Decide the actual array shape and the permutation order for this case
if strcmp(mode,’2D’)
asize = [sz(1)*sz(2), prod(sz(3:end))]; % e.g. [4*X, 22500]
perm = [2,1];
else
asize = sz;
perm = [1,2,4,5,3,6];
end
nel = prod(asize); nbytes = nel*8; % double = 8 bytes/element
fprintf(‘n===== %s | array=[%s] | perm=[%s] =====n’, label, num2str(asize), num2str(perm));
fprintf(‘ %d elements | %d bytes | %.4f GiB | device=%sn’, nel, nbytes, nbytes/2^30, dev);
%% Pre-permute
% Build with every element >= 1 (so any 0 in the output == corruption), on the chosen device
if strcmp(dev,’gpu’)
A = randi([1 100], asize, ‘gpuArray’); % double, on GPU
else
A = randi([1 100], asize); % double, on CPU
end
sumA = gather(sum(A(:))); % computed BEFORE any permute -> trustworthy
nzA = sum(A(:)==0);
% Double-check the count of zeros pre-permute [passes every time]
if nnz(A)~=(numel(A)-nzA)
error(‘Zero count seems wrong’)
end
fprintf(‘ input : min=%g #zeros=%d sum(A)=%.0fn’, gather(min(A(:))), gather(nzA), sumA);
%% Permute
B = permute(A, perm);
nnz1=nnz(B);
Bc = gather(B); % bring to host for trustworthy checks (no-op if already on CPU)
nnz2=nnz(Bc);
% Double-check that gather() is innocent [it is innocent, this never triggers]
if nnz1~=nnz2
error(‘gather() is not innocent’)
end
%% Post-permute
nzBc = sum(Bc(:)==0);
minB = min(Bc(:));
sumB = sum(Bc(:));
% Double-check the count of zeros post-permute [passes every time]
if nnz(Bc)~=(numel(Bc)-nzBc)
error(‘Zero count seems wrong’)
end
fprintf(‘ output: size=[%s] min=%g #zeros=%d sum(B)=%.0fn’, num2str(size(Bc)), minB, nzBc, sumB);
fprintf(‘ sum preserved? %d (lost %.1f%% of total)n’, sumA==sumB, 100*(sumA-sumB)/sumA);
if nzBc>0 || sumA~=sumB
fprintf(‘ >>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<n’);
else
fprintf(‘ OK: permute faithful (no zeros introduced, sum preserved).n’);
end
% Clean everything up between runs, to make sure nothing corrupts across runs
clear B Bc
clear A
reset(gpuDevice);% free GPU memory before the next allocation
end
fprintf(‘nDone.n’);
When this is run, the following is output to Command Window
>>permutetest
CUDADevice with properties:
Name: ‘NVIDIA RTX 4000 Ada Generation’
Index: 1 (of 1)
ComputeCapability: ‘8.9’
DriverModel: ‘N/A’
TotalMemory: 20991901696 (20.99 GB)
AvailableMemory: 20807024640 (20.81 GB)
DeviceAvailable: true
DeviceSelected: true
Show all properties.
===== ~4.0 GB, GPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115243076
output: size=[4 5966 5 3 15 100] min=0 #zeros=500387064 sum(B)=1845835241
sum preserved? 0 (lost 93.2% of total)
>>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<
===== ~3.5 GB, GPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724420469
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724420469
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, CPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=27115350572
output: size=[4 5966 5 3 15 100] min=1 #zeros=0 sum(B)=27115350572
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, CPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=23724663007
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724663007
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, GPU, 2-D transpose | array=[23864 22500] | perm=[2 1] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115442092
output: size=[22500 23864] min=1 #zeros=0 sum(B)=27115442092
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, GPU, 2-D transpose | array=[20880 22500] | perm=[2 1] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724054242
output: size=[22500 20880] min=1 #zeros=0 sum(B)=23724054242
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
Done.
>>The following code reproduces what appears to be an error when using permute, specifically I permute a matrix contains all positive integers, but the permute output contains zeros.
To trigger the error seems to require three things:
(i) big, say >4gb, array (does not trigger on 3.5gb array)
(ii) gpu array (does not trigger for cpu array)
(iii) high dimensional permute (triggers with 6D, but not 2D)
Following is code to reproduce the issue, and below that a copy-paste of what is printed to command window.
[I use Matlab R2025b, my gpu is detailed in the output.]
%% permutetest.m
% There is an error when permuting BIG GPU arrays with HIGH dimensions.
%
% 1. Doing a permute on a 6D gpu array that is big (roughly >4gb) GIVES ERRORS, specifically this is the ‘Case 1’ below.
% The error is that many elements get replaced with zeros.
%
% 2. Doing the same, but on a smaller (<4gb) gpu array does not error (Case 2 below)
% 3. Redoing first two cases, but on the cpu does not error (Cases 3 and 4)
% 4. Redoing first two cases, but only having permute across 2D does not error (Cases 5 and 6).
%
% The matices being permuted contain integers between 1 and 100, so seems
% unlikely that the actual contents are relevant to the error but I have
% not attempted to test this.
clear all
disp(gpuDevice) % show GPU model + available memory
% Sizes via [4, X, 15, 5, 3, 100]: elements = 90000*X, bytes(double) = 720000*X.
Xmid = 5220; % 469,800,000 elems = 3,758,400,000 bytes = 3.500 GiB (~3.5 GB)
Xhigh = 5966; % 536,940,000 elems = 4,295,520,000 bytes = 4.000 GiB (just above 4 GB)
% mode ‘6D’ => permute(A,[1,2,4,5,3,6]) on the array as-is
% mode ‘2D’ => reshape A to a 2-D matrix [4*X, 22500] then permute(A,[2,1])
%%
cases = {
‘~4.0 GB, GPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘6D’; % big, gpu, high dim
‘~3.5 GB, GPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘gpu’, ‘6D’; % small, gpu, high dim
‘~4.0 GB, CPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘cpu’, ‘6D’; % big, cpu, high dim
‘~3.5 GB, CPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘cpu’, ‘6D’; % small, cpu, high dim
‘~4.0 GB, GPU, 2-D transpose’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘2D’; % big, gpu, low dim
‘~3.5 GB, GPU, 2-D transpose’, [4 Xmid 15 5 3 100], ‘gpu’, ‘2D’; % small, gpu, low dim
};
%% Do each case and give feedback on results
for ii=1:size(cases,1)
label = cases{ii,1}; sz = cases{ii,2}; dev = cases{ii,3}; mode = cases{ii,4};
% Decide the actual array shape and the permutation order for this case
if strcmp(mode,’2D’)
asize = [sz(1)*sz(2), prod(sz(3:end))]; % e.g. [4*X, 22500]
perm = [2,1];
else
asize = sz;
perm = [1,2,4,5,3,6];
end
nel = prod(asize); nbytes = nel*8; % double = 8 bytes/element
fprintf(‘n===== %s | array=[%s] | perm=[%s] =====n’, label, num2str(asize), num2str(perm));
fprintf(‘ %d elements | %d bytes | %.4f GiB | device=%sn’, nel, nbytes, nbytes/2^30, dev);
%% Pre-permute
% Build with every element >= 1 (so any 0 in the output == corruption), on the chosen device
if strcmp(dev,’gpu’)
A = randi([1 100], asize, ‘gpuArray’); % double, on GPU
else
A = randi([1 100], asize); % double, on CPU
end
sumA = gather(sum(A(:))); % computed BEFORE any permute -> trustworthy
nzA = sum(A(:)==0);
% Double-check the count of zeros pre-permute [passes every time]
if nnz(A)~=(numel(A)-nzA)
error(‘Zero count seems wrong’)
end
fprintf(‘ input : min=%g #zeros=%d sum(A)=%.0fn’, gather(min(A(:))), gather(nzA), sumA);
%% Permute
B = permute(A, perm);
nnz1=nnz(B);
Bc = gather(B); % bring to host for trustworthy checks (no-op if already on CPU)
nnz2=nnz(Bc);
% Double-check that gather() is innocent [it is innocent, this never triggers]
if nnz1~=nnz2
error(‘gather() is not innocent’)
end
%% Post-permute
nzBc = sum(Bc(:)==0);
minB = min(Bc(:));
sumB = sum(Bc(:));
% Double-check the count of zeros post-permute [passes every time]
if nnz(Bc)~=(numel(Bc)-nzBc)
error(‘Zero count seems wrong’)
end
fprintf(‘ output: size=[%s] min=%g #zeros=%d sum(B)=%.0fn’, num2str(size(Bc)), minB, nzBc, sumB);
fprintf(‘ sum preserved? %d (lost %.1f%% of total)n’, sumA==sumB, 100*(sumA-sumB)/sumA);
if nzBc>0 || sumA~=sumB
fprintf(‘ >>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<n’);
else
fprintf(‘ OK: permute faithful (no zeros introduced, sum preserved).n’);
end
% Clean everything up between runs, to make sure nothing corrupts across runs
clear B Bc
clear A
reset(gpuDevice);% free GPU memory before the next allocation
end
fprintf(‘nDone.n’);
When this is run, the following is output to Command Window
>>permutetest
CUDADevice with properties:
Name: ‘NVIDIA RTX 4000 Ada Generation’
Index: 1 (of 1)
ComputeCapability: ‘8.9’
DriverModel: ‘N/A’
TotalMemory: 20991901696 (20.99 GB)
AvailableMemory: 20807024640 (20.81 GB)
DeviceAvailable: true
DeviceSelected: true
Show all properties.
===== ~4.0 GB, GPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115243076
output: size=[4 5966 5 3 15 100] min=0 #zeros=500387064 sum(B)=1845835241
sum preserved? 0 (lost 93.2% of total)
>>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<
===== ~3.5 GB, GPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724420469
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724420469
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, CPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=27115350572
output: size=[4 5966 5 3 15 100] min=1 #zeros=0 sum(B)=27115350572
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, CPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=23724663007
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724663007
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, GPU, 2-D transpose | array=[23864 22500] | perm=[2 1] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115442092
output: size=[22500 23864] min=1 #zeros=0 sum(B)=27115442092
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, GPU, 2-D transpose | array=[20880 22500] | perm=[2 1] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724054242
output: size=[22500 20880] min=1 #zeros=0 sum(B)=23724054242
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
Done.
>> The following code reproduces what appears to be an error when using permute, specifically I permute a matrix contains all positive integers, but the permute output contains zeros.
To trigger the error seems to require three things:
(i) big, say >4gb, array (does not trigger on 3.5gb array)
(ii) gpu array (does not trigger for cpu array)
(iii) high dimensional permute (triggers with 6D, but not 2D)
Following is code to reproduce the issue, and below that a copy-paste of what is printed to command window.
[I use Matlab R2025b, my gpu is detailed in the output.]
%% permutetest.m
% There is an error when permuting BIG GPU arrays with HIGH dimensions.
%
% 1. Doing a permute on a 6D gpu array that is big (roughly >4gb) GIVES ERRORS, specifically this is the ‘Case 1’ below.
% The error is that many elements get replaced with zeros.
%
% 2. Doing the same, but on a smaller (<4gb) gpu array does not error (Case 2 below)
% 3. Redoing first two cases, but on the cpu does not error (Cases 3 and 4)
% 4. Redoing first two cases, but only having permute across 2D does not error (Cases 5 and 6).
%
% The matices being permuted contain integers between 1 and 100, so seems
% unlikely that the actual contents are relevant to the error but I have
% not attempted to test this.
clear all
disp(gpuDevice) % show GPU model + available memory
% Sizes via [4, X, 15, 5, 3, 100]: elements = 90000*X, bytes(double) = 720000*X.
Xmid = 5220; % 469,800,000 elems = 3,758,400,000 bytes = 3.500 GiB (~3.5 GB)
Xhigh = 5966; % 536,940,000 elems = 4,295,520,000 bytes = 4.000 GiB (just above 4 GB)
% mode ‘6D’ => permute(A,[1,2,4,5,3,6]) on the array as-is
% mode ‘2D’ => reshape A to a 2-D matrix [4*X, 22500] then permute(A,[2,1])
%%
cases = {
‘~4.0 GB, GPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘6D’; % big, gpu, high dim
‘~3.5 GB, GPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘gpu’, ‘6D’; % small, gpu, high dim
‘~4.0 GB, CPU, 6-D permute’, [4 Xhigh 15 5 3 100], ‘cpu’, ‘6D’; % big, cpu, high dim
‘~3.5 GB, CPU, 6-D permute’, [4 Xmid 15 5 3 100], ‘cpu’, ‘6D’; % small, cpu, high dim
‘~4.0 GB, GPU, 2-D transpose’, [4 Xhigh 15 5 3 100], ‘gpu’, ‘2D’; % big, gpu, low dim
‘~3.5 GB, GPU, 2-D transpose’, [4 Xmid 15 5 3 100], ‘gpu’, ‘2D’; % small, gpu, low dim
};
%% Do each case and give feedback on results
for ii=1:size(cases,1)
label = cases{ii,1}; sz = cases{ii,2}; dev = cases{ii,3}; mode = cases{ii,4};
% Decide the actual array shape and the permutation order for this case
if strcmp(mode,’2D’)
asize = [sz(1)*sz(2), prod(sz(3:end))]; % e.g. [4*X, 22500]
perm = [2,1];
else
asize = sz;
perm = [1,2,4,5,3,6];
end
nel = prod(asize); nbytes = nel*8; % double = 8 bytes/element
fprintf(‘n===== %s | array=[%s] | perm=[%s] =====n’, label, num2str(asize), num2str(perm));
fprintf(‘ %d elements | %d bytes | %.4f GiB | device=%sn’, nel, nbytes, nbytes/2^30, dev);
%% Pre-permute
% Build with every element >= 1 (so any 0 in the output == corruption), on the chosen device
if strcmp(dev,’gpu’)
A = randi([1 100], asize, ‘gpuArray’); % double, on GPU
else
A = randi([1 100], asize); % double, on CPU
end
sumA = gather(sum(A(:))); % computed BEFORE any permute -> trustworthy
nzA = sum(A(:)==0);
% Double-check the count of zeros pre-permute [passes every time]
if nnz(A)~=(numel(A)-nzA)
error(‘Zero count seems wrong’)
end
fprintf(‘ input : min=%g #zeros=%d sum(A)=%.0fn’, gather(min(A(:))), gather(nzA), sumA);
%% Permute
B = permute(A, perm);
nnz1=nnz(B);
Bc = gather(B); % bring to host for trustworthy checks (no-op if already on CPU)
nnz2=nnz(Bc);
% Double-check that gather() is innocent [it is innocent, this never triggers]
if nnz1~=nnz2
error(‘gather() is not innocent’)
end
%% Post-permute
nzBc = sum(Bc(:)==0);
minB = min(Bc(:));
sumB = sum(Bc(:));
% Double-check the count of zeros post-permute [passes every time]
if nnz(Bc)~=(numel(Bc)-nzBc)
error(‘Zero count seems wrong’)
end
fprintf(‘ output: size=[%s] min=%g #zeros=%d sum(B)=%.0fn’, num2str(size(Bc)), minB, nzBc, sumB);
fprintf(‘ sum preserved? %d (lost %.1f%% of total)n’, sumA==sumB, 100*(sumA-sumB)/sumA);
if nzBc>0 || sumA~=sumB
fprintf(‘ >>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<n’);
else
fprintf(‘ OK: permute faithful (no zeros introduced, sum preserved).n’);
end
% Clean everything up between runs, to make sure nothing corrupts across runs
clear B Bc
clear A
reset(gpuDevice);% free GPU memory before the next allocation
end
fprintf(‘nDone.n’);
When this is run, the following is output to Command Window
>>permutetest
CUDADevice with properties:
Name: ‘NVIDIA RTX 4000 Ada Generation’
Index: 1 (of 1)
ComputeCapability: ‘8.9’
DriverModel: ‘N/A’
TotalMemory: 20991901696 (20.99 GB)
AvailableMemory: 20807024640 (20.81 GB)
DeviceAvailable: true
DeviceSelected: true
Show all properties.
===== ~4.0 GB, GPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115243076
output: size=[4 5966 5 3 15 100] min=0 #zeros=500387064 sum(B)=1845835241
sum preserved? 0 (lost 93.2% of total)
>>> PERMUTE CORRUPTED THIS ARRAY (a faithful permute is impossible here) <<<
===== ~3.5 GB, GPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724420469
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724420469
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, CPU, 6-D permute | array=[4 5966 15 5 3 100] | perm=[1 2 4 5 3 6] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=27115350572
output: size=[4 5966 5 3 15 100] min=1 #zeros=0 sum(B)=27115350572
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, CPU, 6-D permute | array=[4 5220 15 5 3 100] | perm=[1 2 4 5 3 6] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=cpu
input : min=1 #zeros=0 sum(A)=23724663007
output: size=[4 5220 5 3 15 100] min=1 #zeros=0 sum(B)=23724663007
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~4.0 GB, GPU, 2-D transpose | array=[23864 22500] | perm=[2 1] =====
536940000 elements | 4295520000 bytes | 4.0005 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=27115442092
output: size=[22500 23864] min=1 #zeros=0 sum(B)=27115442092
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
===== ~3.5 GB, GPU, 2-D transpose | array=[20880 22500] | perm=[2 1] =====
469800000 elements | 3758400000 bytes | 3.5003 GiB | device=gpu
input : min=1 #zeros=0 sum(A)=23724054242
output: size=[22500 20880] min=1 #zeros=0 sum(B)=23724054242
sum preserved? 1 (lost 0.0% of total)
OK: permute faithful (no zeros introduced, sum preserved).
Done.
>> gpu, permute MATLAB Answers — New Questions
3 dimension array?
Hi,
How to write 3 or 4 dimansion array?
Thanks,
HenryHi,
How to write 3 or 4 dimansion array?
Thanks,
Henry Hi,
How to write 3 or 4 dimansion array?
Thanks,
Henry MATLAB Answers — New Questions
How do I increase the fontsize used to display text in the Copilot Chat window of the Matlab IDE?
How do I increase the fontsize used to display text in the Copilot Chat window of the Matlab IDE?How do I increase the fontsize used to display text in the Copilot Chat window of the Matlab IDE? How do I increase the fontsize used to display text in the Copilot Chat window of the Matlab IDE? copilot chat MATLAB Answers — New Questions
Accessing a single GPU from different workers of a parpool thread pool
It used to be conventional wisdom that parfor does not play well together with gpuArray on a single-GPU system because different parpool workers end up competing for the same CPU-GPU communication channel. Is that still true now that there is a distinction between process pools and thread pools? Can it be worthwhile to parfor-parallelize a loop containing gpuArray operations if I have only a single GPU?It used to be conventional wisdom that parfor does not play well together with gpuArray on a single-GPU system because different parpool workers end up competing for the same CPU-GPU communication channel. Is that still true now that there is a distinction between process pools and thread pools? Can it be worthwhile to parfor-parallelize a loop containing gpuArray operations if I have only a single GPU? It used to be conventional wisdom that parfor does not play well together with gpuArray on a single-GPU system because different parpool workers end up competing for the same CPU-GPU communication channel. Is that still true now that there is a distinction between process pools and thread pools? Can it be worthwhile to parfor-parallelize a loop containing gpuArray operations if I have only a single GPU? gpu, parpool, thread pools, process pools MATLAB Answers — New Questions
Initialization in Simulink
Is it possible to run a Simulink model with model variables initialized directly from a stored file accessed by Simulink instead of being them being initialized within MATLAB? Whenever I run a Simulink model it seems that I first have to assign values to any MATLAB workspace variables by going into MATLAB- it would be easier if they could be automatically initialized within Simulink. Is that possible?Is it possible to run a Simulink model with model variables initialized directly from a stored file accessed by Simulink instead of being them being initialized within MATLAB? Whenever I run a Simulink model it seems that I first have to assign values to any MATLAB workspace variables by going into MATLAB- it would be easier if they could be automatically initialized within Simulink. Is that possible? Is it possible to run a Simulink model with model variables initialized directly from a stored file accessed by Simulink instead of being them being initialized within MATLAB? Whenever I run a Simulink model it seems that I first have to assign values to any MATLAB workspace variables by going into MATLAB- it would be easier if they could be automatically initialized within Simulink. Is that possible? eric1, callback MATLAB Answers — New Questions
Overwriting table columns with ()-indexing
Suppose I have two tables,
T1=array2table(rand(5,3))
T2=array2table(char(randi([65,90],5,3)),Var={‘Col1′,’Col2′,’Col3’})
I wish to replace the final column of T1 with that of T2. One way to accomplish this is,
T3=[T1(:,1:2) , T2(:,3) ]
Why, though, does this indexing approach not give the same result?
T3=T1;
T3(:,3)=T2(:,3)
The result is the same as what would be obtained with brace indexing,
T3=T1;
T3{:,3}=T2{:,3}
I understand why brace-indexing gives this result, but I thought ()-indexing was supposed to keep the data contained in a table. Why don’t the tabular properties of T2(:,3), like the column name and data type, get transfered as well when parentheses are used?Suppose I have two tables,
T1=array2table(rand(5,3))
T2=array2table(char(randi([65,90],5,3)),Var={‘Col1′,’Col2′,’Col3’})
I wish to replace the final column of T1 with that of T2. One way to accomplish this is,
T3=[T1(:,1:2) , T2(:,3) ]
Why, though, does this indexing approach not give the same result?
T3=T1;
T3(:,3)=T2(:,3)
The result is the same as what would be obtained with brace indexing,
T3=T1;
T3{:,3}=T2{:,3}
I understand why brace-indexing gives this result, but I thought ()-indexing was supposed to keep the data contained in a table. Why don’t the tabular properties of T2(:,3), like the column name and data type, get transfered as well when parentheses are used? Suppose I have two tables,
T1=array2table(rand(5,3))
T2=array2table(char(randi([65,90],5,3)),Var={‘Col1′,’Col2′,’Col3’})
I wish to replace the final column of T1 with that of T2. One way to accomplish this is,
T3=[T1(:,1:2) , T2(:,3) ]
Why, though, does this indexing approach not give the same result?
T3=T1;
T3(:,3)=T2(:,3)
The result is the same as what would be obtained with brace indexing,
T3=T1;
T3{:,3}=T2{:,3}
I understand why brace-indexing gives this result, but I thought ()-indexing was supposed to keep the data contained in a table. Why don’t the tabular properties of T2(:,3), like the column name and data type, get transfered as well when parentheses are used? table, indexing MATLAB Answers — New Questions
solve system of 6
% Define symbolic variables
syms g alpha1 alpha2 sigma c b s1 s2 beta2 E1 U
% Use 0.5 instead of 0.1e1 ./ 0.2e1 for clarity
g_plus_half = g + 0.5;
g_minus_half = g – 0.5;
row1 = [2, 2, 2*besselk(g_plus_half, alpha1), 2*besselk(g_plus_half, alpha2), 2*besseli(g_plus_half, alpha1), 2*besseli(g_plus_half, alpha2)];
row2 = [-7, 2, …
(-3*alpha1*besselk(g_minus_half, alpha1) – besselk(g_plus_half, alpha1)*sigma – 7*besselk(g_plus_half, alpha1)), …
(-3*alpha2*besselk(g_minus_half, alpha2) – besselk(g_plus_half, alpha2)*sigma – 7*besselk(g_plus_half, alpha2)), …
(3*alpha1*besseli(g_minus_half, alpha1) – besseli(g_plus_half, alpha1)*sigma – 7*besseli(g_plus_half, alpha1)), …
(3*alpha2*besseli(g_minus_half, alpha2) – besseli(g_plus_half, alpha2)*sigma – 7*besseli(g_plus_half, alpha2))];
% Simplified row3
term1 = (alpha1^2 * c + alpha1^2 – sigma) / (2*c);
term2 = (alpha2^2 * c + alpha2^2 – sigma) / (2*c);
row3 = [0, 0, …
term1 * (besselk(g_plus_half, alpha1)*beta2*s1*s2 + alpha1*beta2*s1*besselk(g_minus_half, alpha1) + 2*besselk(g_plus_half, alpha1)*beta2*s1 + besselk(g_plus_half, alpha1)), …
term2 * (besselk(g_plus_half, alpha2)*beta2*s1*s2 + alpha2*beta2*s1*besselk(g_minus_half, alpha2) + 2*besselk(g_plus_half, alpha2)*beta2*s1 + besselk(g_plus_half, alpha2)), …
term1 * (besseli(g_plus_half, alpha1)*beta2*s1*s2 – alpha1*beta2*s1*besseli(g_minus_half, alpha1) + 2*besseli(g_plus_half, alpha1)*beta2*s1 + besseli(g_plus_half, alpha1)), …
term2 * (besseli(g_plus_half, alpha2)*beta2*s1*s2 – alpha2*beta2*s1*besseli(g_minus_half, alpha2) + 2*besseli(g_plus_half, alpha2)*beta2*s1 + besseli(g_plus_half, alpha2))];
row4 = [2/(b^3), 2, 2*besselk(g_plus_half, b*alpha1)*b^(-1.5), 2*besselk(g_plus_half, b*alpha2)*b^(-1.5), 2*besseli(g_plus_half, b*alpha1)*b^(-1.5), 2*besseli(g_plus_half, b*alpha2)*b^(-1.5)];
row5 = [-1/(b^3), 2, …
-(alpha1*besselk(g_minus_half, b*alpha1)*b + besselk(g_plus_half, b*alpha1))*b^(-1.5), …
-(alpha2*besselk(g_minus_half, b*alpha2)*b + besselk(g_plus_half, b*alpha2))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha1)*alpha1*b + besseli(g_plus_half, b*alpha1))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha2)*alpha2*b + besseli(g_plus_half, b*alpha2))*b^(-1.5)];
row6 = [0, 0, …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha2) / (2*c) * b^(-2.5), …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha2) / (2*c) * b^(-2.5)];
% Assemble matrix
A = [row1; row2; row3; row4; row5; row6];
% Rename ‘b’ to ‘rhs’ to avoid conflict
rhs = [-U; U; 0; 0; 0; 0];
% Solve symbolically
sol = linsolve(A, rhs);% Define symbolic variables
syms g alpha1 alpha2 sigma c b s1 s2 beta2 E1 U
% Use 0.5 instead of 0.1e1 ./ 0.2e1 for clarity
g_plus_half = g + 0.5;
g_minus_half = g – 0.5;
row1 = [2, 2, 2*besselk(g_plus_half, alpha1), 2*besselk(g_plus_half, alpha2), 2*besseli(g_plus_half, alpha1), 2*besseli(g_plus_half, alpha2)];
row2 = [-7, 2, …
(-3*alpha1*besselk(g_minus_half, alpha1) – besselk(g_plus_half, alpha1)*sigma – 7*besselk(g_plus_half, alpha1)), …
(-3*alpha2*besselk(g_minus_half, alpha2) – besselk(g_plus_half, alpha2)*sigma – 7*besselk(g_plus_half, alpha2)), …
(3*alpha1*besseli(g_minus_half, alpha1) – besseli(g_plus_half, alpha1)*sigma – 7*besseli(g_plus_half, alpha1)), …
(3*alpha2*besseli(g_minus_half, alpha2) – besseli(g_plus_half, alpha2)*sigma – 7*besseli(g_plus_half, alpha2))];
% Simplified row3
term1 = (alpha1^2 * c + alpha1^2 – sigma) / (2*c);
term2 = (alpha2^2 * c + alpha2^2 – sigma) / (2*c);
row3 = [0, 0, …
term1 * (besselk(g_plus_half, alpha1)*beta2*s1*s2 + alpha1*beta2*s1*besselk(g_minus_half, alpha1) + 2*besselk(g_plus_half, alpha1)*beta2*s1 + besselk(g_plus_half, alpha1)), …
term2 * (besselk(g_plus_half, alpha2)*beta2*s1*s2 + alpha2*beta2*s1*besselk(g_minus_half, alpha2) + 2*besselk(g_plus_half, alpha2)*beta2*s1 + besselk(g_plus_half, alpha2)), …
term1 * (besseli(g_plus_half, alpha1)*beta2*s1*s2 – alpha1*beta2*s1*besseli(g_minus_half, alpha1) + 2*besseli(g_plus_half, alpha1)*beta2*s1 + besseli(g_plus_half, alpha1)), …
term2 * (besseli(g_plus_half, alpha2)*beta2*s1*s2 – alpha2*beta2*s1*besseli(g_minus_half, alpha2) + 2*besseli(g_plus_half, alpha2)*beta2*s1 + besseli(g_plus_half, alpha2))];
row4 = [2/(b^3), 2, 2*besselk(g_plus_half, b*alpha1)*b^(-1.5), 2*besselk(g_plus_half, b*alpha2)*b^(-1.5), 2*besseli(g_plus_half, b*alpha1)*b^(-1.5), 2*besseli(g_plus_half, b*alpha2)*b^(-1.5)];
row5 = [-1/(b^3), 2, …
-(alpha1*besselk(g_minus_half, b*alpha1)*b + besselk(g_plus_half, b*alpha1))*b^(-1.5), …
-(alpha2*besselk(g_minus_half, b*alpha2)*b + besselk(g_plus_half, b*alpha2))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha1)*alpha1*b + besseli(g_plus_half, b*alpha1))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha2)*alpha2*b + besseli(g_plus_half, b*alpha2))*b^(-1.5)];
row6 = [0, 0, …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha2) / (2*c) * b^(-2.5), …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha2) / (2*c) * b^(-2.5)];
% Assemble matrix
A = [row1; row2; row3; row4; row5; row6];
% Rename ‘b’ to ‘rhs’ to avoid conflict
rhs = [-U; U; 0; 0; 0; 0];
% Solve symbolically
sol = linsolve(A, rhs); % Define symbolic variables
syms g alpha1 alpha2 sigma c b s1 s2 beta2 E1 U
% Use 0.5 instead of 0.1e1 ./ 0.2e1 for clarity
g_plus_half = g + 0.5;
g_minus_half = g – 0.5;
row1 = [2, 2, 2*besselk(g_plus_half, alpha1), 2*besselk(g_plus_half, alpha2), 2*besseli(g_plus_half, alpha1), 2*besseli(g_plus_half, alpha2)];
row2 = [-7, 2, …
(-3*alpha1*besselk(g_minus_half, alpha1) – besselk(g_plus_half, alpha1)*sigma – 7*besselk(g_plus_half, alpha1)), …
(-3*alpha2*besselk(g_minus_half, alpha2) – besselk(g_plus_half, alpha2)*sigma – 7*besselk(g_plus_half, alpha2)), …
(3*alpha1*besseli(g_minus_half, alpha1) – besseli(g_plus_half, alpha1)*sigma – 7*besseli(g_plus_half, alpha1)), …
(3*alpha2*besseli(g_minus_half, alpha2) – besseli(g_plus_half, alpha2)*sigma – 7*besseli(g_plus_half, alpha2))];
% Simplified row3
term1 = (alpha1^2 * c + alpha1^2 – sigma) / (2*c);
term2 = (alpha2^2 * c + alpha2^2 – sigma) / (2*c);
row3 = [0, 0, …
term1 * (besselk(g_plus_half, alpha1)*beta2*s1*s2 + alpha1*beta2*s1*besselk(g_minus_half, alpha1) + 2*besselk(g_plus_half, alpha1)*beta2*s1 + besselk(g_plus_half, alpha1)), …
term2 * (besselk(g_plus_half, alpha2)*beta2*s1*s2 + alpha2*beta2*s1*besselk(g_minus_half, alpha2) + 2*besselk(g_plus_half, alpha2)*beta2*s1 + besselk(g_plus_half, alpha2)), …
term1 * (besseli(g_plus_half, alpha1)*beta2*s1*s2 – alpha1*beta2*s1*besseli(g_minus_half, alpha1) + 2*besseli(g_plus_half, alpha1)*beta2*s1 + besseli(g_plus_half, alpha1)), …
term2 * (besseli(g_plus_half, alpha2)*beta2*s1*s2 – alpha2*beta2*s1*besseli(g_minus_half, alpha2) + 2*besseli(g_plus_half, alpha2)*beta2*s1 + besseli(g_plus_half, alpha2))];
row4 = [2/(b^3), 2, 2*besselk(g_plus_half, b*alpha1)*b^(-1.5), 2*besselk(g_plus_half, b*alpha2)*b^(-1.5), 2*besseli(g_plus_half, b*alpha1)*b^(-1.5), 2*besseli(g_plus_half, b*alpha2)*b^(-1.5)];
row5 = [-1/(b^3), 2, …
-(alpha1*besselk(g_minus_half, b*alpha1)*b + besselk(g_plus_half, b*alpha1))*b^(-1.5), …
-(alpha2*besselk(g_minus_half, b*alpha2)*b + besselk(g_plus_half, b*alpha2))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha1)*alpha1*b + besseli(g_plus_half, b*alpha1))*b^(-1.5), …
-(-besseli(g_minus_half, b*alpha2)*alpha2*b + besseli(g_plus_half, b*alpha2))*b^(-1.5)];
row6 = [0, 0, …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besselk(g_plus_half, b*alpha2) / (2*c) * b^(-2.5), …
(alpha1^2*b^2*c + alpha1^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha1) / (2*c) * b^(-2.5), …
(alpha2^2*b^2*c + alpha2^2*b^2 – b^2*sigma) * besseli(g_plus_half, b*alpha2) / (2*c) * b^(-2.5)];
% Assemble matrix
A = [row1; row2; row3; row4; row5; row6];
% Rename ‘b’ to ‘rhs’ to avoid conflict
rhs = [-U; U; 0; 0; 0; 0];
% Solve symbolically
sol = linsolve(A, rhs); solve system MATLAB Answers — New Questions
datetime sometimes returns NaT and sometimes throws an error – what is the expected behaviour?
Sometimes datetime throws an error if it can’t return a valid datetime object from a string input:
dt = datetime(["2026_06" "2026_06_13"], Format = "yyyy_MM_dd")
and sometimes it returns NaT:
dt = datetime(["2026_06_13" "2026_06"], Format = "yyyy_MM_dd")
dt =
1×2 datetime array
2026_06_13 NaT
The second result is what I’d expect from the documentation. I’m having difficulty figuring out what the underlying rule is, since the two examples have the same input apart from the order and the same format. It seems to be to do with whether the first element of the array can be interpreted according to the format.
It looks like I have to put every call to datetime in a try-catch block and also test the result result for NaT, if I’m to detect any non-conforming input. This seems excessive – can anyone suggest a better way, or whether this is actually a bug I should try to report?Sometimes datetime throws an error if it can’t return a valid datetime object from a string input:
dt = datetime(["2026_06" "2026_06_13"], Format = "yyyy_MM_dd")
and sometimes it returns NaT:
dt = datetime(["2026_06_13" "2026_06"], Format = "yyyy_MM_dd")
dt =
1×2 datetime array
2026_06_13 NaT
The second result is what I’d expect from the documentation. I’m having difficulty figuring out what the underlying rule is, since the two examples have the same input apart from the order and the same format. It seems to be to do with whether the first element of the array can be interpreted according to the format.
It looks like I have to put every call to datetime in a try-catch block and also test the result result for NaT, if I’m to detect any non-conforming input. This seems excessive – can anyone suggest a better way, or whether this is actually a bug I should try to report? Sometimes datetime throws an error if it can’t return a valid datetime object from a string input:
dt = datetime(["2026_06" "2026_06_13"], Format = "yyyy_MM_dd")
and sometimes it returns NaT:
dt = datetime(["2026_06_13" "2026_06"], Format = "yyyy_MM_dd")
dt =
1×2 datetime array
2026_06_13 NaT
The second result is what I’d expect from the documentation. I’m having difficulty figuring out what the underlying rule is, since the two examples have the same input apart from the order and the same format. It seems to be to do with whether the first element of the array can be interpreted according to the format.
It looks like I have to put every call to datetime in a try-catch block and also test the result result for NaT, if I’m to detect any non-conforming input. This seems excessive – can anyone suggest a better way, or whether this is actually a bug I should try to report? datetime, datetime nat, datetime error MATLAB Answers — New Questions
Why can’t I use “end-2:end” for the meaning of last 2 columns?
Post Content Post Content tutorial MATLAB Answers — New Questions
Wrong frequency and waveform distortion when reading 50Hz AC voltage using F29H85x ADC triggered by ePWM in Simulink
I have this ADC processing structure for the F29H85x in MATLAB to measure a 50Hz AC voltage. The ADC is triggered by an ePWM at a frequency of 10kHz, and the resulting sine wave is captured on the scope as shown. Please help me analyze the issue and give me solution. ThanksI have this ADC processing structure for the F29H85x in MATLAB to measure a 50Hz AC voltage. The ADC is triggered by an ePWM at a frequency of 10kHz, and the resulting sine wave is captured on the scope as shown. Please help me analyze the issue and give me solution. Thanks I have this ADC processing structure for the F29H85x in MATLAB to measure a 50Hz AC voltage. The ADC is triggered by an ePWM at a frequency of 10kHz, and the resulting sine wave is captured on the scope as shown. Please help me analyze the issue and give me solution. Thanks adc f29h85x MATLAB Answers — New Questions









