To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
Suppose i have a text file that contains 1 column, 68160 rows of random data.
Now, i want
for first 480 rows add 0 in first column,
next 480 rows add 5,
next 480 rows add 10,
next 480 rows add 15,
and continue this with increment of 5, until all columns get finished.. and store all this new data in second column...
I want to write MATLAB code.. So, how to do it...?
No products are associated with this question.
Check the below code: a=zeros(68160,1);
if i <= (j+1)*k
else j=j+1; a(i)=a(i)+j*l; end
At first you have to read the file. Therefore you have to know the format of the contents: "random data" could be nearly everything, e.g. floating point numbers like 0.1098435, integers like 134, strings like 'ajdtaoieurgkjahsvbdk', etc. "Adding 0" might imply that you are talking about integer values.
Then a loop seems to be the easiest solution. Just try it and return to the forum in case of problems. It is much easier for the forum users to suggest improvements than to write the complete program from scratch.