From: Thijs on 14 Jul 2010 09:57 Hello, I have a question regarding combining several different row vectors to make one large row vector. Using v3 = [v1, v2] is not an option in this case because I have about 100 vectors that I want to combine to one. Does anybody have a solution for combining a large amount (amount changes often) of vectors? Thank you in advance. Thijs
From: Sean on 14 Jul 2010 10:05 "Thijs " <t.denhamer(a)student.tudelft.nl> wrote in message <i1kfng$t87$1(a)fred.mathworks.com>... > Hello, > > I have a question regarding combining several different row vectors to make one large row vector. Using v3 = [v1, v2] is not an option in this case because I have about 100 vectors that I want to combine to one. Does anybody have a solution for combining a large amount (amount changes often) of vectors? %One way: %Load you row vectors in as cells then use cell2mat A{1} = rand(10,1); A{2} = ones(14,1); cell2mat(A.').'
From: Andy on 14 Jul 2010 10:09 "Thijs " <t.denhamer(a)student.tudelft.nl> wrote in message <i1kfng$t87$1(a)fred.mathworks.com>... > Hello, > > I have a question regarding combining several different row vectors to make one large row vector. Using v3 = [v1, v2] is not an option in this case because I have about 100 vectors that I want to combine to one. Does anybody have a solution for combining a large amount (amount changes often) of vectors? > > Thank you in advance. > > Thijs If you know that you'll be doing this later in the code, then you should collect these vectors together in, for example, a cell array as you create them. That way, when you want to concatenate all of them, you can use: C = {v1 v2 v3 ...}; % your cell array of vectors; V = [C{:}]; % concatenate all of them
From: James Tursa on 14 Jul 2010 10:10 "Thijs " <t.denhamer(a)student.tudelft.nl> wrote in message <i1kfng$t87$1(a)fred.mathworks.com>... > Hello, > > I have a question regarding combining several different row vectors to make one large row vector. Using v3 = [v1, v2] is not an option in this case because I have about 100 vectors that I want to combine to one. Does anybody have a solution for combining a large amount (amount changes often) of vectors? Do they all have different names? How are they created? Can you make them part of a large row vector as they are created? James Tursa
From: us on 14 Jul 2010 10:11
"Thijs " <t.denhamer(a)student.tudelft.nl> wrote in message <i1kfng$t87$1(a)fred.mathworks.com>... > Hello, > > I have a question regarding combining several different row vectors to make one large row vector. Using v3 = [v1, v2] is not an option in this case because I have about 100 vectors that I want to combine to one. Does anybody have a solution for combining a large amount (amount changes often) of vectors? > > Thank you in advance. > > Thijs well... an excellent example why any reasonable MLbber would NEVER create zillions of (enumerated) variables... http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F a possible remedy: - save your VARs in a temp MAT-file... - reload the MAT-file into a STRUCT... - use STRUCT2CELL to turn it into a ... CELL... - use CAT to create an array... us |