Azzera filtri
Azzera filtri

Create a interdependent matrix in Matlab and repeat it for 10 times

1 visualizzazione (ultimi 30 giorni)
Hi, I want to create the below mentioned interdependent matrix Matlab as mentioned below from E101 to S1(blue color) and repeat that for 10 times as done below (green color) E102 to S2 with continuous numbering for each new group(green color) from their previous group(blue color). Can you please help me with this.

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 16 Feb 2018
nm = cellstr(reshape((string({'E','R','E','S'}) + ([101,1,106,1] + (0:9)'))',[],1));
T = repmat({tril(ones(4),-1)},1,10);
out = [{nan},nm';nm,num2cell(blkdiag(T{:}))];
  1 Commento
Santhosh Chandrasekar
Santhosh Chandrasekar il 16 Feb 2018
Sir, Thank you very much. This is what I needed. Can you tell me how to add that "CR" column and row in your given code? I don't want it to be repeated for 10 times, it should be created only once. Can you please add that to your above-mentioned code.

Accedi per commentare.

Più risposte (1)

KSSV
KSSV il 16 Feb 2018
Modificato: KSSV il 16 Feb 2018
L1 = tril(ones(4,4),-1) ;
Z1 = zeros(4) ;
Blue = [L1 ; Z1] ;
Green = [Z1 ; L1] ;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by