Problem in string-number concatenation
조회 수: 1 (최근 30일)
이전 댓글 표시
hello, I am trying to concatenate two matrices, A=['a1';'a2';'a3';'a4'] and Z=[190;64;4;5]. I am not able to do so.
Can someone help please. Thanks Annika
채택된 답변
Andrei Bobrov
2014년 8월 21일
use cell array
A={'a1';'a2';'a3';'a4'};
Z=[190;64;4;5];
out = [A, num2cell(Z)];
추가 답변 (1개)
David Sanchez
2014년 8월 21일
Define your A array as a cell using brackets { }:
A={'E';'F';'G';'H';'I';'J';'K';'L';'M';'N';'O';'P';'Q';'R';'S';'T';'U';'V';'W';'X';'Y';'Z';'D'};
Iy =[ 190 64 4 5 190 95 4 190 65 65 150 190 190 66 185 5 190 43 185 2 5 100 4];
B=Iy';
r=[A,num2cell(B)];
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!