function write numberous vectors out

1 view (last 30 days)
Hellow, i want to write a function that generates a amount of vectors (projections) with length size. I have written this but it doesnt work. Plz help
function f(i) = opvullen( projections,Lx,Ly )
%try to write vectors
size=Lx*Ly;
for i=1:projections
f(i)=zeros(1,size);
end
  1 Comment
Andrew Newell
Andrew Newell on 2 Apr 2011
How does it not work? Are you getting an error message?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Apr 2011
As cell array:
function f = opvullen( projections,Lx,Ly )
%try to write vectors
size=Lx*Ly;
f = cell(projections,1);
for i=1:projections
f{i}=zeros(1,size);
end
Or, as numeric array since they are all the same size
function f = opvullen( projections,Lx,Ly )
%try to write vectors
size=Lx*Ly;
f = zeros(size,projections);
for i=1:projections
f(:,projections)=zeros(1,size);
end

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!