Filling symbolic arrays while setting zeros when filling these arrays since useless variables
2 次查看(过去 30 天)
显示 更早的评论
Hello, below a code snippet to fill the symbolic matrixes FISH_BIG_GCsp and FISH_BIG_XC. Unfortunately, I am not filling entirely these 2 arrays and the execution takes a loo long time since I am taking into account unncessary symbolic values.
The ideal would be to have like I do for numerical arrays, that is to say, set zeros(31,31) and fill after the arrays with assignement : that allows me to not take into account (or at least simplify the execution time) the zeros.
But I don't know how to do the same it with symbolic arrays. If someone could help me, this would be fine
Here below the code snippet :
FISH_SYM = sym('xc_', [31,31], 'positive');
FISH_BIG_GCsp = sym('sp_', [31,31], 'positive');
FISH_BIG_XC = sym('xc_', [31,31], 'positive');
% Block bias spectro + pshot and correlations
FISH_BIG_GCsp(1:7,1:7) = FISH_GCsp_SYM(1:7,1:7)
FISH_BIG_GCsp(7:17,7:17) = FISH_GCsp_SYM(7:17,7:17)
FISH_BIG_GCsp(1:7,7:17) = FISH_GCsp_SYM(1:7,7:17)
FISH_BIG_GCsp(7:17,1:7) = FISH_GCsp_SYM(7:17,1:7)
% Block bias photo and correlations
FISH_BIG_XC(1:7,1:7) = FISH_XC_SYM(1:7,1:7)
FISH_BIG_XC(21:31,21:31) = FISH_XC_SYM(11:21,11:21)
FISH_BIG_XC(1:7,21:31) = FISH_XC_SYM(1:7,11:21)
FISH_BIG_XC(21:31,1:7) = FISH_XC_SYM(11:21,1:7)
% Block I.A and correlations
FISH_BIG_XC(18:20,18:20) = FISH_XC_SYM(8:10,8:10)
FISH_BIG_XC(1:7,18:20) = FISH_XC_SYM(1:7,8:10)
FISH_BIG_XC(18:20,1:7) = FISH_XC_SYM(8:10,1:7)
% Final summation
FISH_SYM = FISH_BIG_GCsp + FISH_BIG_XC
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!