a small program help

4 views (last 30 days)
aditi
aditi on 3 Apr 2014
Answered: Image Analyst on 3 Apr 2014
I have three files: 1) file1.ap and 2) file2.ap and 3)file3.ap with form as follows:
file1
1 2 3
4 5 6
7 8 9
file2
12 15 16
13 18 19
14 21 22
file3
22
24
33
i want to add 2nd and 3rd column of file 1 & file2 to file3 as rows i.e i want:
22 2 3 5 6 8 9
24 15 16 18 19 21 22
33
please help me with the program.

Answers (1)

Image Analyst
Image Analyst on 3 Apr 2014
You can do that with a cell array (<http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F>) or if you put something like nan in the "missing" columns of row 3. So fill out array 1 and 2 with nans, then stitch together
f_out = [f3, f1', f2'];

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!