Why Cell array is created in different way ?

1 view (last 30 days)
Hi I am creating a cell array like this
SensorList.sensorname = ...
{ 'Wind speed (m/s)' 'Vhub'; % 1
'Electrical power (KW)' 'P'; % 2
}
If i run this in matlab, im getting
SensorList.sensorname
'Wind speed (m/s)' 'Vhub'
[1x21 char] 'P'
If i refer SensorList.sensorname{2,1}, i get Electrical power (KW). But why it is showing [1x21 char]. Im facing some difficulty in the next steps of my iteration, pls tell me the difference in the way cell array is created in column 1. How to create it in the same way as Wind speed.

Accepted Answer

Jan
Jan on 30 Jun 2012
This concerns only the display in the command window, while the actual value is correct and as expected.
Th DISP command is called to show the contents of the cell in the command window. This command tries to give the output a tabular appearance and therefore it abbreviates long strings.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!