Add a new column to an existing matrix in MATLAB?

懵懂的女人 提交于 2019-12-02 04:38:35

I am not sure how to add another column onto a matrix

How to add a column to an existing matrix ?

Example:

      1 1 1
Mat = 1 1 1
      1 1 1

        3
Col =   3
        3


Mat = [Mat, Col];


          1 1 1 3
   Mat =  1 1 1 3
          1 1 1 3



apre=dlmread('filename.csv',',',1,0);
a=[apre(1:180,:)]

a is a matrix of size 180x2 iff filename.csv has 2 columns.

a = [a, a(:, 2).*399/(a(180, 2))];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!