How to find location of parameters in a genarized matrix
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Ayush Aniket
2024-10-28,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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Portfolio Optimization and Asset Allocation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!