From: Pallab Ghosh on 9 Apr 2010 10:35 Hi All, I am a new user of Parallel Computing Toolbox. Would you please help me to figure out how to save a matrix (generated from parfor loop) as a text file. Here is the example: A = zeros(3, 3, 10); parfor k = 1:10 A(:, :, k) = k*rand(3); end Now I want to save matrix "A" as a text file. I used all the following format but nothing works: '-ascii' 8-digit ASCII format. '-ascii', '-tabs' Tab-delimited 8-digit ASCII format. '-ascii', '-double' 16-digit ASCII format. '-ascii', '-double', '-tabs' Tab-delimited 16-digit ASCII format. I got the following error : "Warning: Attempt to write an unsupported data type to an ASCII file.Variable 'A' not written to file." Thanks and Regards, Pallab (Student).
From: C T on 9 Apr 2010 12:40 "Pallab Ghosh" <karna.sakara(a)gmail.com> wrote in message <hpndvg$pep$1(a)fred.mathworks.com>... > Hi All, > I am a new user of Parallel Computing Toolbox. Would you please help me to figure out how to save a matrix (generated from parfor loop) as a text file. Here is the example: > > A = zeros(3, 3, 10); > parfor k = 1:10 > A(:, :, k) = k*rand(3); > end > > Now I want to save matrix "A" as a text file. > > I used all the following format but nothing works: > > '-ascii' 8-digit ASCII format. > > '-ascii', '-tabs' Tab-delimited 8-digit ASCII format. > > '-ascii', '-double' 16-digit ASCII format. > > '-ascii', '-double', '-tabs' Tab-delimited 16-digit ASCII format. > > I got the following error : "Warning: Attempt to write an unsupported data type to an ASCII file.Variable 'A' not written to file." > > Thanks and Regards, > Pallab (Student). The problem is not the parfor, but the 3D matrix. You are basically trying to save a 3D matrix to a text file which are not supported by matlab. The easiest thing is to change A back to 2D matrix. Like below: As=reshape(A,3,30); save -ascii 'As.txt' 'As'
|
Pages: 1 Prev: Trouble with trigger and time-out Next: facial recognition using EBGM |