From: Ian on
I have a text file called threes.txt that is formatted this way:
[0, 1, 0; 1, 1, 0; 0, 0, 0]
containing 512 3x3 matrices in rows like this. Earlier I did:
T = fopen('threes.txt')
CT = textscan(T,'[%d,%d,%d;%d,%d,%d;%d,%d,%d]',512)
and CT is then a cell array of 9 512x1 objects. I cannot figure out how to properly construct MT, an array of 512 3x3 matrices, from CT. Can anyone help with this?

Thank you.
From: Donn Shull on
"Ian " <fourfouriers(a)gmail.com> wrote in message <hm9g5a$bkc$1(a)fred.mathworks.com>...
> I have a text file called threes.txt that is formatted this way:
> [0, 1, 0; 1, 1, 0; 0, 0, 0]
> containing 512 3x3 matrices in rows like this. Earlier I did:
> T = fopen('threes.txt')
> CT = textscan(T,'[%d,%d,%d;%d,%d,%d;%d,%d,%d]',512)
> and CT is then a cell array of 9 512x1 objects. I cannot figure out how to properly construct MT, an array of 512 3x3 matrices, from CT. Can anyone help with this?
>
> Thank you.

Hi Ian,

There are probably better ways of reading this data than textscan, but to answer your question you could do the following

CT = reshape(cell2mat(CT)', 3, 3, 512);
for index = 1:512
CT(:, :, index) = CT(:, :, index)';
end

Hope this Helps,

Donn