Special matrix with zeros and ones
Ältere Kommentare anzeigen
Hello Everyone,
I have a special matrix and can not create it in faster way
The example of a matrix is as follows:
m=[1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]
I can build it up by using ones and zeros, but it will take me a long time to do that, specially when I have a very big matrix.
Thanks in advance.
2 Kommentare
Jan
am 6 Mär. 2015
I've formatted your code.
James Tursa
am 6 Mär. 2015
It's going to take us even longer unless we know the pattern rules. Can you explain a bit more about what the pattern is for a "very big matrix"?
Akzeptierte Antwort
Weitere Antworten (2)
Rodney Buller
am 6 Mär. 2015
1 Stimme
Have you given this a try?
m=zero[4 16] m(1,1:4)=1; m(2,5:8)=1; m(3,9:12)=1; m(4,13:16)=1;
Assign a matrix as large as you need then, assigning values afterwards. variable(row,column)=assignment val
1 Kommentar
ABDULAZIZ
am 6 Mär. 2015
0 Stimmen
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!