How do I combine character strings and numeric arrays using fprintf?
조회 수: 10 (최근 30일)
이전 댓글 표시
Basically need help with the syntax, I need to have the first column of the table a string array of characters and the next three a matrix of numerical values
댓글 수: 0
답변 (2개)
Stephen23
2017년 11월 8일
>> C = {'Anna','Bob','Charly','Diane'};
>> M = rand(4,3);
>> D = [C(:),num2cell(M)]';
>> fprintf('%8s %8f %8f %8f\n',D{:})
Anna 0.713433 0.187407 0.376554
Bob 0.140956 0.777929 0.433123
Charly 0.888480 0.623920 0.942841
Diane 0.734345 0.404552 0.725598
>>
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 LaTeX에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!