MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Thread Subject: convert string vector to matrix

 Subject: convert string vector to matrix From: Benjamin Date: 7 Sep, 2012 10:53:07 Message: 1 of 3 Hi all, I want to know how to convert the following vector (56*1) to a 7*8 matrix A =     'LLY'     'NOK'     'RIMM'     'BK'     'SAN'     'AIG'     'COH'     'COP'     'PG'     'KO'     'WMT'     'JNJ'     'GE'     'F'     'HMC'     'TM'     'T'     'CSCO'     'AXP'     'LNKD'     'AVP'     'C'     'LVMUY'     'BHP'     'QCOM'     'NSC'     'BBVA'     'HRL'     'NFLX'     'UTX'     'AMD'     'NWSA'     'MCD'     'SBUX'     'POT'     'BAC'     'BIDU'     'SINA'     'DANG'     'YOKU'     'RENN'     'QIHU'     'STP'     'TSLA'     'MSFT'     'SAP'     'SI'     'MET'     'JPM'     'TOT'     'DDAIF'     'PTR'     'PEP'     'BCS'     'LYG'     'HBC' I tried vec2mat (A, 7) and A=[A(1:7) A(8:16) A(17:21) A(22:28) A(29:35) A (36:42) A(43:49) A (50:56)]; Both did not work
 Subject: convert string vector to matrix From: Barry Shaw Date: 7 Sep, 2012 11:08:07 Message: 2 of 3 >> A={'A';'B';'C';'D'} A =     'A'     'B'     'C'     'D' >> B=reshape(A,2,2) B =     'A' 'C'     'B' 'D' "Benjamin " wrote in message ... > Hi all, > > I want to know how to convert the following vector (56*1) to a 7*8 matrix > > A = > > 'LLY' > 'NOK' > 'RIMM' > 'BK' > 'SAN' > 'AIG' > 'COH' > 'COP' > 'PG' > 'KO' > 'WMT' > 'JNJ' > 'GE' > 'F' > 'HMC' > 'TM' > 'T' > 'CSCO' > 'AXP' > 'LNKD' > 'AVP' > 'C' > 'LVMUY' > 'BHP' > 'QCOM' > 'NSC' > 'BBVA' > 'HRL' > 'NFLX' > 'UTX' > 'AMD' > 'NWSA' > 'MCD' > 'SBUX' > 'POT' > 'BAC' > 'BIDU' > 'SINA' > 'DANG' > 'YOKU' > 'RENN' > 'QIHU' > 'STP' > 'TSLA' > 'MSFT' > 'SAP' > 'SI' > 'MET' > 'JPM' > 'TOT' > 'DDAIF' > 'PTR' > 'PEP' > 'BCS' > 'LYG' > 'HBC' > > I tried vec2mat (A, 7) and > A=[A(1:7) A(8:16) A(17:21) A(22:28) A(29:35) A (36:42) A(43:49) A (50:56)]; > Both did not work
 Subject: convert string vector to matrix From: Benjamin Date: 7 Sep, 2012 11:43:07 Message: 3 of 3 Thank Barry, it really works.