How to find location of parameters in a genarized matrix
3 views (last 30 days)
Show older comments
I want to find the location of tunable parameters within a generalized matrix.
I want to make sure I don't miss parameters with values set to zero, so converting to double won't work.
Is this possible?
For example:
p = realp('p', 0);
A = genmat(zeros(5));
A(2,4) = p;
% now find the location of p in A
0 Comments
Answers (1)
Ayush Aniket
on 28 Oct 2024 at 8:52
There is no MATLAB function that would provide you the location of these tunable parameter within the generalized matrix. However, if the goal is to interact and change the value of these paramters, you can use the Blocks propoerties of the matrix. Refer to the following documentation link to read about the property:
If you need the location of the parameters, a hackish workaround is to use the usubs function to substitute the tunable parameters with unique identifiers and then identify their locations as shown below:
p = realp('p', 0);
A = genmat(zeros(5));
A(2,4) = p;
% Substitute the tunable parameter with a unique value
% This helps in identifying the location of the parameter
uniqueValue = 1; % Use a unique non-zero value
A_sub = usubs(A, 'p', uniqueValue);
% Find the location of the unique value
[row, col] = find(A_sub == uniqueValue);
0 Comments
See Also
Categories
Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!