필터 지우기
필터 지우기

How to ignore some elements of function returned vector?

조회 수: 1 (최근 30일)
NMTri
NMTri 2014년 1월 8일
답변: David Sanchez 2014년 1월 8일
When writing my code, I need some elements from the returned vector. For example:
y=zeros(100,1003);
for ii=1:100
y(ii,:)=conv(h(ii,:),x(ii,:));
end
I just want y(:,4:end); and I my solution is:
y(:,1:3)=[];
I think that matlab should have an elegant expression for this case. Is there any suggestion. Something like:
y=zeros(100,1000);
for ii=1:100
y(ii,:)=conv(h(ii,:),x(ii,:))(4:1003); %of course it's not correct :(
end
Thanks in advance :)

채택된 답변

David Sanchez
David Sanchez 2014년 1월 8일
I am sure that knowing what is h and x would give some other ideas, but, Why don't you just do this?:
y = zeros(100,1000);
for ii=1:100
tmp = conv(h(ii,:),x(ii,:));
y(ii,:) = tmp(4:end);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assembly에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by