display contents of cell array and a vector together

1 Ansicht (letzte 30 Tage)
Elysi Cochin
Elysi Cochin am 14 Mär. 2020
Bearbeitet: Ameer Hamza am 14 Mär. 2020
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

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 14 Mär. 2020
Bearbeitet: Ameer Hamza am 14 Mär. 2020
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

Weitere Antworten (0)

Kategorien

Mehr zu Cell Arrays finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by