# How to create image from arrays by random themself ?

1 view (last 30 days)
Jenifer NG on 14 Jul 2022
Commented: Jenifer NG on 14 Jul 2022
Dear all,
I want to create a image by using defined arrays a b c in a ramdom step to get a image 44x400 pixel
Could anyone help me?
a = [119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 38 42 36 30 35 17 23 29 29 31 27 18 17 51]
b = [144 118 123 109 88 78 77 71 78 80 74 82 87 78 71 59 39 53 35 37 41 40 26 37 40 38 31 36 40 35 36 31 33 37 23 27 24 32 23 27 28 23 5 32]
c = [133 112 97 92 79 75 78 74 60 74 72 68 76 70 60 54 56 46 43 54 46 40 43 41 41 36 41 39 34 30 17 17 30 16 10 21 26 30 29 21 18 11 19 48]
newimage = [ a
b
c
b
c
c
b
a
....
400]

Jonas on 14 Jul 2022
Edited: Jonas on 14 Jul 2022
a = [119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 38 42 36 30 35 17 23 29 29 31 27 18 17 51];
b = [144 118 123 109 88 78 77 71 78 80 74 82 87 78 71 59 39 53 35 37 41 40 26 37 40 38 31 36 40 35 36 31 33 37 23 27 24 32 23 27 28 23 5 32];
c = [133 112 97 92 79 75 78 74 60 74 72 68 76 70 60 54 56 46 43 54 46 40 43 41 41 36 41 39 34 30 17 17 30 16 10 21 26 30 29 21 18 11 19 48];
together=[a;b;c];
numOfRows=400;
randomRowsIdx=randi(3,numOfRows,1);
together(randomRowsIdx,:)
ans = 400×44
133 112 97 92 79 75 78 74 60 74 72 68 76 70 60 54 56 46 43 54 46 40 43 41 41 36 41 39 34 30 144 118 123 109 88 78 77 71 78 80 74 82 87 78 71 59 39 53 35 37 41 40 26 37 40 38 31 36 40 35 133 112 97 92 79 75 78 74 60 74 72 68 76 70 60 54 56 46 43 54 46 40 43 41 41 36 41 39 34 30 119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 133 112 97 92 79 75 78 74 60 74 72 68 76 70 60 54 56 46 43 54 46 40 43 41 41 36 41 39 34 30 119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 119 79 76 101 119 99 72 77 94 82 76 84 92 86 63 54 45 47 59 69 56 59 52 48 48 41 41 38 41 42 144 118 123 109 88 78 77 71 78 80 74 82 87 78 71 59 39 53 35 37 41 40 26 37 40 38 31 36 40 35
note that the result is 400x44 and not 44x400.
Jenifer NG on 14 Jul 2022
Thanks you

### Categories

Find more on Blocked Images in Help Center and File Exchange

R2022a

### Community Treasure Hunt

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

Start Hunting!

Translated by