Hello, I would like to try to make an array into a different size of array.
If I assume my array one is 1×16 array, and my desired one is 1×100 array at desired rows, how can I translate it?
For example, I can achieve it manually as decribed below (W – exsist array, WD desired array):
WD(1,34) = W(1,1);
WD(1,35) = W(1,2);
WD(1,36) = W(1,3);
WD(1,37) = W(1,4);
WD(1,44) = W(1,5);
WD(1,45) = W(1,6);
WD(1,46) = W(1,7);
WD(1,47) = W(1,8);
WD(1,54) = W(1,9);
WD(1,55) = W(1,10);
WD(1,56) = W(1,11);
WD(1,57) = W(1,12);
WD(1,64) = W(1,13);
WD(1,65) = W(1,14);
WD(1,66) = W(1,15);
WD(1,67) = W(1,16);
other rows of WD is 0.
However, when I try to do it by using for loops, it only reads the last value of W(1,16) onto the desired points on WD.
This is my for loops.
for i = 30:10:60 for j = 4:7 for k = 1:16 WD(1,i+j) = W(1,k); end for l = 68:100 WD(1,l) = 0; end endend
I believe I have to modify the loop status somehow, but I found it difficult at the moment.
How can I fix it?
Any help would be much appreciated.
Thank you.
Best Answer