function write numberous vectors out

3 次查看(过去 30 天)
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

采纳的回答

Walter Roberson
Walter Roberson 2011-4-2
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Types 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by