I would like to load to load the following data into arrays/matrices in matlab f
ID: 2248499 • Letter: I
Question
I would like to load to load the following data into arrays/matrices in matlab from a .txt or .dat file. How would I do this? The following data is only part of what I want to load into matlab.
Initial Row Pointer,
1 4 8 11 14 17 20 23 30 33 38 41 44 47 50 56
59 62 65 68 71 74 77 80 83 89 92 95 98 101 104 108
111 114 122 124 127 130 133 136 139 142 144 147 152 156 159 162
Column Indices,
1 222 286 2 9 228 298 3 95 166 4 126 259 5 83 228
6 109 213 7 45 65 8 38 117 119 199 211 267 2 9 222
10 49 106 216 303 11 122 124 12 25 80 13 90 294 14 80
Matrix Elements,
1.4228970e+003 -2.8653300e+000 -1.1363640e+001 1.0620990e+002 -2.5906730e+000
-1.0000000e+002 -3.6192540e+000 6.0945060e+001 -3.1446540e+001 -2.9498530e+001
6.1890250e+000 -2.7631940e+000 -3.4258310e+000 8.8031730e+000 -6.4102560e+000
-2.3929170e+000 1.4570730e+001 -5.2770450e+000 -9.2936800e+000 7.3622990e+000
-4.3610990e+000 -3.0012000e+000 1.4065840e+002 -4.1152260e+001 -6.0901340e+000
-2.2371360e+001 -1.2135920e+001 -1.6891890e+001 -4.2016810e+001 -2.5906730e+000
5.5405260e+000 -2.9498530e+000 3.2911140e+001 -4.0832990e+000 -2.1367520e+001
-1.9047620e+000 -5.5555550e+000 6.5775930e+000 -2.0872470e+000 -4.4903460e+000
1.9762380e+001 -5.8927520e+000 -1.3869630e+001 6.0700260e+000 -2.9154520e+000
-3.1545740e+000 2.4922590e+001 -1.2406950e+001
Explanation / Answer
At first copy the .txt or .dat file in MATLAB directory and make sure that it appears on the current folder list in MATLAB. Then enter the following code in MATLAB to get the data separately.
CC = importdata('11.txt',',',1);
tC=CC.data(:,1);
VC=CC.data(:,end);
rename 11.txt to the filename you use and if you want to see your file in matrix format enter the following code in MATLAB
A=CC.data;