i want a good syntax form

조회 수: 1 (최근 30일)
Mahmoud Chawki
Mahmoud Chawki 2022년 5월 16일
답변: Mahmoud Chawki 2022년 5월 16일
s is matrix that has 6 rows and Qbar is an array that contains n number of matrices matrices
s(1,:)*Qbar{1}
s(2,:)*Qbar{1}
s(3,:)*Qbar{2}
s(4,:)*Qbar{2}
s(5,:)*Qbar{3}
s(6,:)*Qbar{3}
this is how i want it to be
is there any syntax i can make this happen?

답변 (2개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 5월 16일
Using loop: Is that OK?
data_cell=cell(..,..) %Preallocate Memory
iter=1:3:size(s,1);
for i=1:3:6
data_cell{i}=s(i,:)*Qbar{i}
data_cell{i+1}=s(i+1,:)*Qbar{i}
end
  댓글 수: 6
Mahmoud Chawki
Mahmoud Chawki 2022년 5월 16일
i have an array of matrices which is:
Qbar{i}=inv(Sbar{i})
do you know how can i exctract each matrix from this array of matrices?
KALYAN ACHARJYA
KALYAN ACHARJYA 2022년 5월 16일
array of matrices can be store as Cell array, it can be extarted using { } bracket
mat{1} represents the first matrics with the cell array.

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


Mahmoud Chawki
Mahmoud Chawki 2022년 5월 16일
yes i know but how can i store what im extracting without having to assign them each time manually

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by