How to convert column to a cell's arrays?

4 views (last 30 days)
BN
BN on 5 Nov 2022
Answered: VBBV on 5 Nov 2022
Dear all,
I want to know how I can convert columns of a 444*5 array (namely CF, attached to this question) to cell arrays; where the cell size is 1*444 (each of 444 rows contains a 1*5 double array).
Thank you

Accepted Answer

VBBV
VBBV on 5 Nov 2022
D = load('CF.mat')
D = struct with fields:
CF: [444×5 double]
D.CF
ans = 444×5
132.6478 133.5434 134.4389 135.3345 136.2301 125.3750 125.5565 125.7379 125.9194 126.1008 123.1060 114.1110 105.1160 96.1211 87.1261 68.5260 59.1084 49.6908 40.2732 30.8556 41.6045 36.6020 31.5995 26.5971 21.5946 42.0444 38.3940 34.7436 31.0932 27.4428 68.8907 68.0732 67.2557 66.4383 65.6208 62.8754 66.1955 69.5156 72.8357 76.1558 55.9440 59.5890 63.2340 66.8790 70.5240 58.4338 63.0261 67.6184 72.2108 76.8031
for k = 1:height(D.CF)
I{k,:} = D.CF(k,:);
end
I
I = 444×1 cell array
{[132.6478 133.5434 134.4389 135.3345 136.2301]} {[125.3750 125.5565 125.7379 125.9194 126.1008]} {[ 123.1060 114.1110 105.1160 96.1211 87.1261]} {[ 68.5260 59.1084 49.6908 40.2732 30.8556]} {[ 41.6045 36.6020 31.5995 26.5971 21.5946]} {[ 42.0444 38.3940 34.7436 31.0932 27.4428]} {[ 68.8907 68.0732 67.2557 66.4383 65.6208]} {[ 62.8754 66.1955 69.5156 72.8357 76.1558]} {[ 55.9440 59.5890 63.2340 66.8790 70.5240]} {[ 58.4338 63.0261 67.6184 72.2108 76.8031]} {[ 64.7676 69.9192 75.0708 80.2224 85.3740]} {[ 99.3017 104.2372 109.1727 114.1082 119.0437]} {[124.7688 126.7274 128.6860 130.6445 132.6031]} {[130.8485 131.4230 131.9976 132.5722 133.1467]} {[ 114.5351 107.8726 101.2100 94.5475 87.8850]} {[ 89.9856 78.7590 67.5324 56.3058 45.0792]}

More Answers (0)

Categories

Find more on Data Types in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!