MATLAB: How to reduce writing using cat command cat commandfor loopreduce Best Answer Hi, play some trick will do.x{1,1} = [1 1 3; 4 5 6];x{1,2} = [1 2 3; 5 6 7];x{1,3} = [1 2 3; 4 5 6];y1 =[];for i = 1:1:length(x) y1 = cat(3,y1,cat(3,x{1,i})); end Related SolutionsMATLAB: What does mean this X=[A’B’C’] ? Why not try it in command window??A,B and C are turned into column vectors and are horizantally concatenated with each other.Note: always use nonconjugate transpose instead of conjugate transpose.>> A = [1 2 3]B = [-1 1 3]C = [5 6 7]A = 1 2 3B = -1 1 3C = 5 6 7>> X = [A' B' C']X = 1 -1 5 2 1 6 3 3 7>> MATLAB: How to vectorize a substitution for each row of a matrix The easy way is to create an anonymous function out of ‘row’ and do it numerically:data = [1 3; 6 3; 7 2]; % x y pairsrowfun = @(x,y) [cos(x) x+y x.*y];m = rowfun(data(:,1), data(:,2))m = 0.5403 4 3 0.96017 9 18 0.7539 9 14 Related QuestionHow to concatenate two matricesArrayfun once with 4 variables, or twice with 2 in each, then mult. Why do these two approaches give different solutionsSubtraction for Matrix of Different LengthShowing points on a graphHow to concatenate rows
Best Answer