1 write a function attatchones that will receive three input
1- write a function attatch_ones that will receive three input arguments, ( 1) an array (matrix/vector/scalar), (2) the numbers of rows, (3) the numbers of columns of the \"one block\" and will return a concatenated (joinded) matrix of the input array together.
2-write a function swap_cols that will recieve three input arguments, (1) an array, (2) a column number, (3) another column number, and will return the array after swapping the values in one column with another
USING MATLAB
Solution
 function arra = attach_ones (arr,r,c)
 [row,col]=size(arr)
 for i=1:r
 for j=1:col+c
 if(j>col)
 arr(i,j)=1
 end
 end
 end
 arra=arr
 end
 function arra = swap_cols(arr,col_num1,col_num2)
 [r,c]=size(arr)
 for i=1:r
 for j=1:c
 if(j==col_num1)
 temp=arr(i,j)
 arr(i,j)=arr(i,col_num2)
 arr(i,col_num2)=temp
 end
 end
 end
 arra=arr
 end
 swap_cols([1,3,2;4,6,5;7,9,8],2,3)
 attach_ones([1,3,2;4,6,5;7,9,8],3,2)

