Effacer les filtres
Effacer les filtres

function write numberous vectors out

1 vue (au cours des 30 derniers jours)
Fiboehh
Fiboehh le 2 Avr 2011
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 commentaire
Andrew Newell
Andrew Newell le 2 Avr 2011
How does it not work? Are you getting an error message?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 2 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur Data Types dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by