display contents of cell array and a vector together

조회 수: 2 (최근 30일)
Elysi Cochin
Elysi Cochin 2020년 3월 14일
편집: Ameer Hamza 2020년 3월 14일
i have a cell array
cell_array = {'A' 'B' 'C'} and
value = [ 10 20 30]
how can i display the cell_array and value_vector together as a string or in a table
A = 10
B = 20
C = 30

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 3월 14일
편집: Ameer Hamza 2020년 3월 14일
cell_array = {'A' 'B' 'C'};
value = [ 10 20 30];
arrayfun(@(x,y) fprintf('%s = %d\n', x{:}, y), cell_array, value);
Result
A = 10
B = 20
C = 30

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by