필터 지우기
필터 지우기

Call a element of Varying Column vector

조회 수: 5 (최근 30일)
Chaudhary P Patel
Chaudhary P Patel 2022년 4월 28일
댓글: Chaudhary P Patel 2022년 4월 29일
Kt=rand(6,6);
u=rand(6,6);
for i=1:1:6
for n=1:1:5
fr(:, i)=Kt*u(:,i) % i am try to call earch column of u here for multiplying with Kt, if i am wrong please correct me.
eval(['fr',num2str(n),'=Kt*u(:,i)'])
end
end
%%% Now i want to call each element of fr one by one how can i call it.

채택된 답변

David Hill
David Hill 2022년 4월 28일
Hard to understand what you are trying to do. Eval statement makes no sense as well as the douple for-loop. Eval would be overriding each i-loop to the same values. Why not just:
Kt=rand(6,6);
u=rand(6,6);
fr=Kt*u;
Then index into fr. To call each element in fr,
for k=1:numel(fr)
fr(k)
end
  댓글 수: 7
Chaudhary P Patel
Chaudhary P Patel 2022년 4월 28일
sir, @David Hill ,what i am exactly want, i am unable to explain here without complete code. sir i mailed you. please reply me.
Chaudhary P Patel
Chaudhary P Patel 2022년 4월 29일
@David Hill sir, please correct me.
ut=rand(15,1);
uy=([0.84;0.384;0.784]);
eval (['U_y','=[u_y;u_y;u_y;u_y;u_y]']);
for n=1:15
if ut(n,1)<=U_y(n,1)
ut(n,1)=ut(n,1);
else
ut(n,1)=0;
end
utt(:,1)=ut(n,1); %% i want to store the ut as a utt in a column
end

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by