[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to append horizontally the data array from the FOR loop?


I have to append requisite data matrix from multiple files into a single variable using FOR loop.

outData = [];

for file in fileList:
   allData = ....                # an array of nrows and ncols.
   outData = [outData; allData]  # in MATLAB

While the ncols are constant, the nrows will vary. My intention is to append the allData (with variable rows) from each file into the outData. 

1. Can anyone suggest how I can do this with an example?

2. How can I save this outData (data matrix) with delimiter (comma) and precision of '%8.5f' or any other into a .txt or .csv file or any other type?

3. How can I append the header on the top of this output file?

Thanks in advance