How to generate and store in different sizes vectors or cells in a loop?

조회 수: 1 (최근 30일)
Rede
Rede 2022년 7월 31일
댓글: Rede 2022년 7월 31일
Good morning,
I have an initial vector:
A=[0.01, 0.12, 0.017, ....] %100 elemets
Vneg=[v1;v2;v3...v6];
Vpos=[v1;v2;v3...v6];
I want to genereate new vectors (according to number of Vneg) between two limites Vneg and Vpos.
In this example I expect to get 06 vectors with values of A between each Vneg and Vpos
I tried this code:
for con=1:length(Vneg);
interval(con)=A(A(:,1)>=Fneg(con2) & A(:,1)<=Fpos(con2));
end
And keep getting an error message.
I tried with cell arrays. can't figure it out.
any help please?

채택된 답변

Matt J
Matt J 2022년 7월 31일
편집: Matt J 2022년 7월 31일
Use cell arrays.
interval=cell(1,length(Vneg));
for con=1:length(Vneg);
interval{con}=A(A(:,1)>=Fneg(con2) & A(:,1)<=Fpos(con2));
end

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by