|
soms.sharma@gmail.com wrote in message <cfb037ff-f11b-4d59-b97d-261e9a0a84bc@n33g2000pri.googlegroups.com>...
> Hi,
>
> I have to read comma delimited array data with nonuniform
> rows,columns. I just needed to read these data into single array A.
> I did like this:
>
> A=dlmread(filename, ',' )
>
> but this does not displays all data and introduces unwanted zeros.
> What I need is just in the form of continous array.
> A(1)=1157
> A(2)=1088
> ....
>
> A(n)=957
>
> Could you please suggest how to accomplish this task?
>
> 1157,1088,1169,1169,984,1322,1178,1103,1211,1292,
> 1124,
> 1171,1133,
> 1227,1142,1216,1259,1299,1232,1117,1155,
> 1232,1083,1020,1394,1196,1148,1083,1189,1133,1034,
> 1157,1034,1097,1299,1157,1130,1155,1349,1232,1103,
> 1103,1083,1027,1166,1148,1250,1155,1047,1054,1018,
> 1189,1126,1250,1297,1178,1043,1103,1250,1272,1169,
> 1004,1083,1164,1124,1027,995,1169,1270,1011,1247,
> 1101,1004,1004,1065,1223,1184,1216,1180,1142,1277,
> 1206,1076,1076,1189,1121,1178,1031,1076,1178,1209,
> 1022,1220,1070,1126,1058,1216,1358,1184,1083,1097,
> 1119,1097,1097,1153,1153,1151,1151,1151,1184,1097,
> 1043,1043,1002,1152,1097,1034,1002,989,1092,1115,
> 1115,1047,1040,1038,1085,1126,1058,1067,1115,1263,
> 1124,1110,1097,1097,1157,1000,991,995,1013,1007,
> 971,971,980,993,1043,1097,982,971,971,1065,
> 1022,1029,989,1029,995,982,1090,980,971,957
You can use TEXTSCAN:
>> fid = fopen(filename);
>> d = textscan(fid, '%f', 'delimiter', ',');
>> d = d{1};
|