필터 지우기
필터 지우기

Can we create submatrices of similar elements of matrix.

조회 수: 2 (최근 30일)
k khaja
k khaja 2022년 12월 31일
답변: Stephen23 2022년 12월 31일
I have matrix {'v1' 'e1' 'v2' 'e3' 'v3' 'e4' 'v3' 'e5' 'v4'} and I want to create sub matrices where all vs should go into one matrix and all es should go into another matrix.
Like V = {'v1' 'v2' 'v3' 'v3' 'v4'} and E = {'e1' 'e3' 'e4' 'e5'}
Thanks in advance

채택된 답변

Stephen23
Stephen23 2022년 12월 31일
VS = {'v1','e1','v2','e3','v3','e4','v3','e5','v4'};
E = VS(startsWith(VS,'e'))
E = 1×4 cell array
{'e1'} {'e3'} {'e4'} {'e5'}
V = VS(startsWith(VS,'v'))
V = 1×5 cell array
{'v1'} {'v2'} {'v3'} {'v3'} {'v4'}

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by