필터 지우기
필터 지우기

function write numberous vectors out

조회 수: 3 (최근 30일)
Fiboehh
Fiboehh 2011년 4월 2일
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
Andrew Newell
Andrew Newell 2011년 4월 2일
How does it not work? Are you getting an error message?

댓글을 달려면 로그인하십시오.

채택된 답변

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