Matlab: create objects with source information -
i loading file ...
obj = load('foo1.txt'); % obj double array of size (ny,nx)
however, there many such files , wish parse save them in array
asdf = zeros(1, numobjs); index = 1:numobjs obj = load(sprintf(foo%d.txt,index)); asdf(index) = obj; end
in case, procedure fails since number of objects in asdf(i), namely size of ... 1 ~= size of obj ... sizeof(obj).
i tried fooling around struct, couldn't find suitable solution.
thanks.
you can use cell array instead:
asdf{numobjs} = []; % intialises; not preallocate memory cell contents index = 1:numobjs asdf{index} = load(sprintf(foo%d.txt,index)); end
Comments
Post a Comment