필터 지우기
필터 지우기

array with vectors as elements

조회 수: 88 (최근 30일)
Jetty Rakesh Aditya
Jetty Rakesh Aditya 2020년 10월 24일
편집: Ameer Hamza 2020년 10월 24일
i have two column vectors
c1 = 1
0
c2 = 0
1
i want to store them as elements in an array. How can i do so?

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 10월 24일
편집: Ameer Hamza 2020년 10월 24일
c = {}
c{1} = [1; 0];
c{2} = [0; 1];
Access them using brace indexing
c{1}; % first vector
c{2}; % second vector
The alternative is to create a matrix and assign these values as columns. However, this will only work if all elements have equal lengths.
c = zeros(2,2);
c(:,1) = [1; 0];
c(:,2) = [0; 1];

추가 답변 (0개)

카테고리

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