#### read & write CSV file

analog=100; % analog signal data
digital=200; % digital signal data
get_date=datestr(now,1); % current date
get_time=datestr(now,13); % current time
**********************************************************
1st four lines are the sample input data.
what i want to do is, put the input data to the CSV file.
then, i can read the data from CSV file to Matlab.
so, how to write the coding to save the data as a CSV file and read
it to Matlab?
thanks.......

 2
chxxangie (11)
12/12/2006 4:13:55 AM
comp.soft-sys.matlab 209782 articles. 11 followers. lunamoonmoon (258) is leader.

3 Replies
10175 Views

Similar Articles

[PageSpeed] 10

<http://xdm001.googlepages.com/0.htm>
#25104;&#40857;15&#20301;&#22899;&#21451;
#23089;&#20048;&#22280;&#19982;&#40657;&#31038;&#20250;&#25581;&#31192
;
#32769;&#33433;&#33993; &#29616;&#36523;
#28504;&#38271;&#27743;&#22899;&#20799;
#36229;&#22899;&#38394;&#25151;&#29031;
#36213;&#34183;&#26368;&#28608;&#29190;
#36234;&#21335; &#36229;&#32423;&#22899;&#22768;
#24352;&#38064;&#31532;&#19968;&#27425;
#31456;&#23376;&#24609;&#34987;&#38519;&#23475;
#33395;&#36935; &#20856;&#22411;&#24863;&#21463;
#20007;&#23613;&#22825;&#33391;&#34384;&#24453;
#24352;&#22269;&#31435;&#28508;&#35268;&#21017;
#22899;&#22823;&#23398;&#29983;&#25588;&#20132; &#25581;&#31192;
#21253;&#20108;&#22902;&#38754;&#35797;
#33016;&#37096;&#19979;&#22402;&#22899;&#26143;
#36229;&#20840;&#22899;&#26143;&#38472;&#24180;&#38706;&#28857;
#29579;&#23567;&#20011; &#39321;&#38394;
#21016;&#22025;&#29618;&#20599;&#27426;
#39640;&#22278;&#22278;&#24576;&#23381;&#29031;
#21488;&#28286;&#22899;&#29983;&#23487;&#33293;&#29983;&#27963;
#20154;&#32905;&#21253;&#23376;&#38138;
#24615;&#25945;&#32946;&#30005;&#24433;
#22899;&#32593;&#21451;&#33258;&#25293;
#27969;&#34892;&#35821;&#38155;&#32447;
#26519;&#24535;&#29618;&#30495;&#31354;&#20889;&#30495;
#25581;&#24320;sm&#38544;&#31192;
#20419;&#38144;&#27792;&#28020;&#38706;
#24352;&#33402;&#35851;&#21046;&#40644;&#36137;&#40644;
#39640;&#26657;&#29482;&#22836;&#20107;&#20214;
#20234;&#33021;&#38745;&#27792;&#28020;&#20889;&#30495;
3&#20159;&#21253;&#20859;&#40654;&#26126;
#32769;&#27721;&#25366;&#27934;&#30423;&#37329;&#24211;
#26368;&#32463;&#20856;&#26234;&#21147;&#39064;
#26377;&#27602;&#23478;&#24120;&#33756;
#36798;&#21033;&#22253;&#27966;&#20013;&#21507;&#20986;&#27700;&#38134
;
#19971;&#22823;&#21464;&#24577;&#20107;&#20214;
#38271;&#22478;&#21051;&#23383;&#30340;&#20154;
#32599;&#20241;&#27891;&#35013;&#35825;&#24785;
#23486;&#39302;&#25353;&#25705;&#22899;
#21271;&#20140;&#39134;&#36710;&#20826;
#21644;&#23578;&#21644;&#23612;&#22993;&#23567;&#36164;&#29983;&#27963
;
#25581;&#23494;&#38024;&#23380;&#25668;&#20687;
#21271;&#20140;&#22320;&#38081;&#31192;&#23494;
#40644;&#20581;&#32724;&#36766;&#32844;
#21560;&#27602;&#22899;&#38463;&#20029;
0&#20998;&#38047;&#24555;&#24863;
#24352;&#38739;&#39062;&#37202;&#21543;&#27468;&#22899;&#29031;
#26446;&#20122;&#40527;&#37202;&#21543;&#28041;&#40644;
#26368;&#20855;&#35825;&#24785;&#21147;&#29031;&#29255;
#24352;&#33402;&#35851;&#22825;&#20307;&#28020;
#26126;&#26143;&#24618;&#30294;
#20083;&#27713;&#20316;&#30011;
#38597;&#21033;&#23433;&#23156;&#20799;
#23391;&#24191;&#32654;&#36947;&#27465;
#20911;&#23548;&#36873;&#33016;
#22763;&#20853;&#25414;&#32465;&#22899;&#20853;
#25163;&#26426;&#25746;&#35854;&#36719;&#20214;
&#22969;&#20799; &#33016;&#37096;&#21338;&#23458;
#21016;&#22025;&#29618;&#24576;&#23381;
#28023;&#22806;&#20020;&#26102;&#22827;&#22971;
#65351;&#22969;&#20799; &#33016;&#37096;&#21338;&#23458;
#33487;&#20025;&#32418;&#40493;&#34507;
#23380;&#23376;&#21741;&#20102;
#36896;&#26143;&#20869;&#24149;
#25945;&#20320;&#22914;&#20309;&#19981;&#29233;&#20182;
#22899;&#22823;&#23398;&#29983;&#21246;&#24341;&#23380;&#23376;
#21016;&#20134;&#33778;&#21521;&#37070;&#26391;&#27714;&#29233;
#27873;&#27819;&#33310;&#20250;
#20013;&#22269;&#39640;&#26657;&#33618;&#21776;&#20107;&#20214;
#20869;&#22320;&#22899;&#26143;&#22823;&#35946;&#23429;
#28385;&#22478;&#23613;&#26159;&#21152;&#29677;&#26063;
#28436;&#33402;&#22280;&#28508;&#35268;&#21017;
#24188;&#25945;&#32654;&#30473;
#29579;&#33778;&#20135;&#21518;
#23567;&#22992;&#20174;&#33391; &#35821;&#24405;
#39640;&#23448;&#21518;&#20195;&#22823;&#26126;&#26143;
#20013;&#22269;&#21313;&#22823;&#20919;&#28448;&#22478;&#24066;
#22788;&#22899;&#24773;&#32467;
#32852;&#36890;&#20449;&#21495;&#19981;&#22909;
#33539;&#20912;&#20912;&#36386;&#20154;
#22899;&#23376;&#20465;&#20048;&#37096;&#39118;&#26223;
#33539;&#20912;&#20912;&#33258;&#25293;
#26397;&#40092;&#22899;&#20853;
#21608;&#36805;&#22823;&#40784;&#29233;&#24034;
#28789;&#24322;&#26696;&#20214;
#22899;&#26143;&#28404;&#34880;&#25104;&#21517;
#23567;&#22992;&#22521;&#35757;&#29677;
#22899;&#26143;&#25104;&#21517;&#20195;&#20215;
#24352;&#26575;&#33437;&#24576;&#23381;
#23608;&#20307;&#20892;&#22330;
#22899;&#27169;&#29305;&#33216;&#37096;&#20923;&#20260;
#22992;&#24351;&#24651;&#20154;
#21464;&#24577;&#20844;&#20132;
#26805;&#39640;&#22902;&#22902;
#21478;&#31867;&#36710;&#27169;
#22825;&#20307;&#28023;&#28393;
#24208;&#23665;&#21306;&#32418;&#21313;&#23383;&#21307;&#38498;
#39640;&#20711;&#24320;&#20809;&#25163;&#26426;&#21495;
#22899;&#26143;&#20986;&#28020;
#22899;&#26126;&#26143;&#37326;&#22806;&#26356;&#34915;
#39321;&#38394;&#31192;&#20107;
#33539;&#20912;&#20912;&#21021;&#21563;&#29031;&#29255;
#26333;&#20809;&#33539;&#20912;&#20912;
#28608;&#24773;&#22899;&#37070;&#22812;&#29983;&#27963;
#39118;&#20113;&#28608;&#24773;&#20889;&#30495;&#22270;&#29255;
#33258;&#25293;&#36208;&#20809;
#22899;&#29983;&#23487;&#33293;&#21453;&#20599;&#31397;
#40644;&#33394;&#32593;&#31449;
#25104;&#20154;&#35770;&#22363;
#28608;&#24773;&#22270;&#29255;a
#25104;&#20154;&#22270;&#29255;
#40644;&#33394;&#22270;&#29255;
#33433;&#33993;&#22992;&#22992;&#22352;&#21488;
#33394;&#24773;&#22270;&#29255;
#40644;&#33394;&#30005;&#24433;
#24041;&#20432;&#38706;&#28857;
#33394;&#24773;&#32593;&#31449;
#40644;&#33394;&#35770;&#22363;
#28608;&#24773;&#30005;&#24433;
#22899;&#26143;&#33016;&#37096;&#30334;&#24180;&#36215;&#20239;&#21490
;
#33394;&#24773;&#35770;&#22363;
#25104;&#20154;&#32593;&#31449;
#22899;&#29983;&#35946;&#25918;&#27605;&#19994;&#29031;
#32769;&#25151;&#19996;&#20599;&#31397;&#32654;&#23569;&#22919;
#22823;&#23398;&#22899;&#29983;&#19981;&#33391;&#34892;&#20026;
#26368;&#26131;&#22833;&#36523;&#22823;&#23398;&#25490;&#34892;&#27036
;
#26657;&#33457;&#31038;&#20132;&#21490;
#21016;&#23569;&#22855;&#30340;&#20845;&#20010;&#22971;&#23376;
#21313;&#22823;&#20498;&#38665;&#26126;&#26143;
#20154;&#22934;&#22812;&#29983;&#27963;
#25945;&#24072;&#22235;&#27004;&#25172;&#23398;&#29983;
#20892;&#27665;&#23094;&#21016;&#20134;&#33778;
#32769;&#22806;&#32781;&#27969;&#27667;
#26446;&#28248;&#23130;&#21069;&#29983;&#27963;
#25442;&#22971;&#20465;&#20048;&#37096;
#30495;&#23454;&#38754;&#30446;
&#26472;&#38064;&#33721;&#31169;&#23478;&#29031;
#21016;&#20134;&#33778;&#22882;&#20360;&#29983;&#27963;
#26126;&#26143;&#31532;&#20108;&#32844;&#19994;
#22899;&#29983;&#23487;&#33293;&#21351;&#35848;&#31169;&#25151;&#35805
;
#30007;&#29256;&#26790;&#38706;
#27442;&#22899;&#20889;&#30495;
#24352;&#38739;&#39062;&#24191;&#21578;&#29260;
#38155;&#33437;&#23436;&#23130;
#33539;&#20912;&#20912;&#29579;&#23398;&#20853;&#21516;&#23621;
#29579;&#33778;&#28789;&#24322;&#20107;&#20214;
#35874;&#38662;&#38155;&#24352;&#26575;&#33437;&#23130;&#21518;&#20142
;&#30456;
#20108;&#22902;&#36827;&#20837;&#35789;&#20856;
#27604;&#22522;&#23612;&#29702;&#21457;&#24215;
#23089;&#20048;&#22280;&#20083;&#27807;&#22823;&#25112;
#22899;&#26143;&#30495;&#23454;&#33016;&#37096;&#23610;&#23544;
#23089;&#20048;&#22280;&#21313;&#22823;&#39578;&#22899;
#20852;&#22859;&#30340;&#21160;&#20316;
#20840;&#36879;&#26126;&#35033;&#23376;
#26126;&#26143;&#34384;&#22971;
#20522;&#34425;&#27905;&#33016;&#37096;&#36973;&#36418;&#36495;
#34903;&#19978;&#36208;&#20809;&#30340;&#20154;
#21069;&#21488;&#23567;&#22992;&#24149;&#21518;&#29983;&#27963;
#28139;&#33633;&#23569;&#22919;
#26085;&#26412;AV&#22899;&#20248;
#26753;&#21647;&#29738;&#28608;&#21563;&#29467;&#30007;
#28608;&#24773;&#36148;&#22270;&#35770;&#22363;
#22899;&#26143;&#20002;&#20154;
#26519;&#24515;&#22914;&#30340;&#19977;&#32423;&#29255;
#21488;&#28286;18&#30005;&#24433;&#32593;
#28608;&#24773;&#27491;&#20856;&#33258;&#25293;
#24615;&#20132;&#30005;&#24433;
#19977;&#32423;&#30701;&#29255;
#33539;&#20912;&#20912;&#37027;&#20123;&#20107;&#20799;
#22871;&#22871;&#20107;&#20214;
#39118;&#39578;&#23569;&#22919;
#23569;&#22919;&#33258;&#25293;
#28139;&#33633;&#23567;&#35828;
#27597;&#23376;&#20081;&#20262;
#25581;&#23494;&#26126;&#26143;&#30495;&#23454;&#36523;&#20221;
#26126;&#26143;&#22812;&#29983;&#27963;
#39118;&#39578;&#28139;&#33633;&#39321;&#33395;&#23569;&#22919;
#24188;&#22899;&#30005;&#24433;
#20004;&#24615;&#30693;&#35782;&#32593;
#32654;&#22899;&#35064;&#20307;&#38706;&#28857;&#22270;&#29255;
#28608;&#24773;&#22899;&#37070;
#25252;&#22763;&#21046;&#26381;&#35825;&#24785;
#29087;&#22899;&#20081;&#20262;&#32593;

#22920;&#22920;&#30340;&#23617;&#32929;
#20813;&#36153;&#24615;&#20132;&#30005;&#24433;
#20813;&#36153;&#28139;&#30005;&#24433;
#25104;&#20154;&#23567;&#30005;&#24433;
#20813;&#36153;&#25104;&#20154;&#30005;&#24433;
#25104;&#20154;&#19977;&#32423;&#29255;
#39321;&#28207;&#19977;&#32423;&#29255;
#38889;&#22269;&#19977;&#32423;&#29255;
#26519;&#24515;&#22914;&#20889;&#30495;
#20154;&#20307;&#25668;&#24433;&#22270;&#29255;
#27934;&#25151;&#21021;&#22812;&#22270;&#29255;
#27748;&#21152;&#20029;&#20154;&#20307;&#33402;&#26415;
#39640;&#36319;&#32654;&#33151;&#19997;&#34972;&#22270;&#29255;
#20154;&#20307;&#33402;&#26415;&#22270;&#29255;
#20154;&#20307;&#33402;&#26415;&#25668;&#24433;&#22270;&#29255;
#20108;&#26376;&#20011;&#22836;&#28608;&#24773;&#20889;&#30495;
#30005;&#24433;&#25945;&#23376;&#27934;&#25151;
#26519;&#24515;&#22914;&#19977;&#32423;&#29255;
#20813;&#36153;&#24615;&#29233;&#30005;&#24433;
#21313;&#20843;&#30005;&#24433;&#32593;
#28608;&#24773;&#35270;&#39057;&#33258;&#25293;
#28608;&#24773;&#27491;&#28857;&#33258;&#25293;
#21320;&#22812;&#28608;&#24773;&#22899;&#37070;
#22899;&#24615;&#25163;&#28139;&#22270;&#29255;
#35064;&#20307;&#22899;&#20154;&#22270;&#29255;
#24615;&#34384;&#24453;&#29031;&#29255;
#25104;&#20154;&#23567;&#35828;&#19979;&#36733;
#24615;&#29983;&#27963;&#30005;&#24433;
#28418;&#20142;&#32654;&#30473;&#22270;&#29255;
#32654;&#22899;&#28431;&#28857;&#20599;&#25293;
#28608;&#24773;&#20889;&#30495;&#35270;&#39057;
#20813;&#36153;&#28608;&#24773;&#22270;&#29255;
#35064;&#20307;&#32654;&#22899;&#36148;&#22270;
#20004;&#24615;&#29983;&#27963;&#22270;&#29255;
#32654;&#22899;&#38452;&#25143;&#38452;&#36947;&#38452;&#27611;
#32654;&#22899;&#33073;&#34915;&#30701;&#29255;
#27748;&#21152;&#20029;&#20889;&#30495;&#38598;
#36855;&#22904;&#32654;&#22899;
#36718;&#22904;&#29031;&#29255;
#20081;&#20262;&#22270;&#29255;
#40644;&#33394;&#23567;&#35828;&#19979;&#36733;
#26126;&#26143;&#21512;&#25104;&#35064;&#29031;
#26085;&#26412;&#19977;&#32423;&#29255;
#20813;&#36153;&#19977;&#32423;&#29255;
#20813;&#36153;&#24615;&#30005;&#24433;
#40644;&#33394;&#23567;&#30005;&#24433;
#40644;&#33394;&#30005;&#24433;
#24615;&#29233;&#23567;&#30005;&#24433;
#24615;&#29233;&#30005;&#24433;
#25104;&#20154;&#20004;&#24615;&#30005;&#24433;
#21488;&#28286;&#30005;&#24433;
#21488;&#28286;&#21313;&#20843;&#30005;&#24433;
#22312;&#32447;&#30475;&#30005;&#24433;
#21320;&#22812;&#30005;&#24433;
#28608;&#24773;MM&#35270;&#39057;
#32654;&#22899;&#20889;&#30495;&#30005;&#24433;
#22312;&#32447;&#20813;&#36153;&#23567;&#30005;&#24433;
#19979;&#36733;&#25104;&#20154;&#30701;&#29255;
#26085;&#26412;&#40644;&#33394;&#23567;&#30005;&#24433;
#20813;&#36153;&#40644;&#33394;&#32593;&#31449;
#20813;&#36153;&#20570;&#29233;&#30005;&#24433;
b&#25104;&#20154;&#23567;&#30005;&#24433;
#24615;&#29233;&#35270;&#39057;
#25104;&#20154;&#35270;&#39057;
#20813;&#36153;&#30005;&#24433;&#27427;&#36175;
#19977;&#32423;&#30005;&#24433;
#20570;&#29233;&#30005;&#24433;&#19979;&#36733;
#38889;&#22269;&#40644;&#33394;&#32593;&#31449;
#26085;&#26412;&#40644;&#33394;&#32593;&#31449;
#24615;&#29233;&#23567;&#35828;
#20570;&#29233;&#23567;&#30005;&#24433;
#25104;&#20154;&#24433;&#38498;
#22312;&#32447;&#24615;&#20132;&#30005;&#24433;
#24615;&#20132;&#30005;&#24433;&#19979;&#36733;
#22312;&#32447;&#24615;&#29233;&#30005;&#24433;
#30475;&#24615;&#29233;&#30005;&#24433;
#24615;&#29233;&#30005;&#24433;&#19979;&#36733;
#22312;&#32447;&#19977;&#32423;&#29255;
#19977;&#32423;&#29255;&#19979;&#36733;
#30475;&#40644;&#33394;&#30005;&#24433;
#22312;&#32447;&#40644;&#33394;&#30005;&#24433;
#40644;&#33394;&#30005;&#24433;&#19979;&#36733;
#25104;&#20154;&#22270;&#29255;
#25104;&#20154;&#36148;&#22270;
#25104;&#20154;&#23567;&#35828;
#25104;&#20154;&#33258;&#25293;
#35064;&#20307;&#32654;&#22899;
#24615;&#29233;&#22270;&#29255;
#24615;&#20132;&#22270;&#29255;
#40644;&#33394;&#22270;&#29255;
#35064;&#20307;&#22270;&#29255;
#20813;&#36153;&#23567;&#30005;&#24433;
#33395;&#24773;&#23567;&#35828;
#38463;&#23016;&#30340;&#23617;&#32929;
#28608;&#24773;&#22899;&#37070;
#21475;&#20132;&#32923;&#20132;&#35270;&#39057;
#21475;&#20132;&#32923;&#20132;
&#29255;&#20465;&#20048;&#37096;
#22823;&#20247;&#25104;&#20154;&#32593;
#25104;&#20154;&#32593;&#31449;
#21313;&#20843;&#30005;&#24433;
#21488;&#28286;&#21313;&#20843;
#24615;&#31119;&#32852;&#30431;
#24615;&#31119;&#29983;&#27963;
#24615;&#25945;&#32946;&#29255;
#24433;&#35270;&#22312;&#32447;
#21697;&#33394;&#22530;&#35770;&#22363;
#25104;&#20154;&#30701;&#29255;
#22312;&#32447;&#25104;&#20154;&#30701;&#29255;
#40644;&#33394;&#35270;&#39057;
#40644;&#33394;&#32593;&#31449;
#24615;&#29233;&#25216;&#24039;
#24773;&#33394;&#35770;&#22363;
#22312;&#32447;&#30005;&#24433;
#30005;&#24433;&#19979;&#36733;
#32654;&#22899;&#35270;&#39057;
#30005;&#24433;&#32593;&#31449;
#30005;&#24433;&#22823;&#20840;
#40644;&#33394;&#36148;&#22270;
#22312;&#32447;&#23567;&#30005;&#24433;
#24615;&#25945;&#32946;&#30005;&#24433;
#24615;&#29233;&#25991;&#23398;
#25104;&#20154;&#28216;&#25103;
#35825;&#24785;&#33258;&#25293;&#19979;&#36733;
#24615;&#29233;&#36148;&#22270;
#33394;&#24773;&#25991;&#23398;
#20813;&#36153;&#30005;&#24433;
#25104;&#20154;&#35770;&#22363;
#25104;&#20154;&#20070;&#24211;
#24773;&#33394;&#30005;&#24433;
#33394;&#24773;&#32593;&#31449;
#25104;&#20154;&#33394;&#24773;
#35064;&#20307;&#32654;&#22899;&#35270;&#39057;&#33258;&#25293;
#24378;&#26292;&#30005;&#24433;&#22270;
#24378;&#22904;&#30005;&#24433;
#34588;&#31348;&#28608;&#24773;&#22270;&#29255;
#24773;&#33394;&#23567;&#35828;
#24773;&#33394;&#31505;&#35805;
#24378;&#22904;&#20048;&#36259;
#24378;&#22904;&#22270;&#29255;
#24378;&#22904;&#23567;&#35828;
#32654;&#22899;&#20083;&#25151;
#24378;&#22904;&#24188;&#22899;
#24773;&#33394;&#20048;&#36259;
#24773;&#33394;&#35270;&#39057;
#24773;&#33394;&#25991;&#21270;
#24773;&#33394;&#23567;&#30005;&#24433;
#24773;&#33394;&#20889;&#30495;
#20840;&#35064;&#30005;&#24433;
#20840;&#35064;&#35270;&#39057;
#20840;&#35064;&#22270;&#29255;
#35033;&#24213;&#39118;&#20809;
#35033;&#24213;&#28287;&#20102;
#35033;&#24213;&#36208;&#20809;
#20154;&#20861;&#24615;&#20132;
#20154;&#20307;&#35064;&#20307;
#20154;&#20307;&#20889;&#30495;
#20154;&#20307;&#33402;&#26415;
#26085;&#26412;&#22899;&#23398;&#30005;&#24433;
#39578;&#23620;&#33258;&#25293;
#33394;&#24773;BT&#19979;&#36733;
#20813;&#36153;&#30475;&#30005;&#24433;
#32654;&#22899;&#22270;&#29255;
#28608;&#24773;&#22270;&#29255;
#20599;&#24773;&#30007;&#22899;
#26085;&#26412;&#21345;&#36890;A&#29255;
&#22899;&#22823;&#23398;&#29983;&#21334;&#28139;

 0
JHG
12/12/2006 5:26:20 AM
Hi Angie,

Try this function.  Little Clunky but it get's the job done.

function writeCSV(analog,digital,get_date,get_time)
csvHold = [num2str(analog) ',' num2str(digital) ',' get_date ','
get_time];
dlmwrite('test.csv',csvHold,'Delimiter','');

------------------------------
You can then use this script to load the csv back in.  The data is
placed in cell array 'x'.

fid = fopen('test.csv');
x = textscan(fid,'%n%n%s%s','delimiter',',');
fclose(fid);

Good luck! b

On Dec 11, 11:13 pm, "angie chuah" <chxxan...@yahoo.com> wrote:
> analog=100; % analog signal data
> digital=200; % digital signal data
> get_date=datestr(now,1); % current date
> get_time=datestr(now,13); % current time
> **********************************************************
> 1st four lines are the sample input data.
> what i want to do is, put the input data to the CSV file.
> then, i can read the data from CSV file to Matlab.
> so, how to write the coding to save the data as a CSV file and read
> it to Matlab?
> thanks.......


 0
benkoziol (3)
12/12/2006 7:06:46 AM
Yeah! this coding is really works...
thank you so much.....

> Hi Angie,
>
> Try this function. Little Clunky but it get's the job done.
>
> function writeCSV(analog,digital,get_date,get_time)
> csvHold = [num2str(analog) ',' num2str(digital) ',' get_date ','
> get_time];
> dlmwrite('test.csv',csvHold,'Delimiter','');
>
> ------------------------------
> You can then use this script to load the csv back in. The data is
> placed in cell array 'x'.
>
> fid = fopen('test.csv');
> x = textscan(fid,'%n%n%s%s','delimiter',',');
> fclose(fid);
>
> Good luck! b
>

 0
chxxangie (11)
12/12/2006 9:43:02 AM

Similar Artilces:

ooRexx reading & writing CSV files
In case this is of interest to anybody, I have posted at www.sahananda.fwbo.net/rexx an ooRexx class called csvStream which subclasses the stream class and allows one to read/write CSV files directly to/from Array objects. If the CSV file has header lines one can read/write to/from Table objects. It copes with all that came to light (including embedded quotes, and literals that span more than one line.) in the 'recent' thread "Revisting the CSV Challange -- what is the most eloquent way to parse a CSV" which has now been dormant nearly four years. it would allow something ...

Read & Write Midi files SMF in Matlab
Hi, Iwhat tools does matlab provide to read standard midi files (SMF)? I found the miditoolbox <http://www.jyu.fi/musica/miditoolbox/> and a script that reads midi files <http://www.kenschutte.com/midi/> Do you know of any other ways to read midi files in matlab? greetings, Ramon Hi der, I've found a exciting website for dis. http://vaaiibhav.me/how-to-read-midi-files-in-matlab/...

Write table data into flat file(.csv,.txt) and again read it from flat file(.csv,.txt)

Hi All, &nbsp; I am plotting one parameter against two parameters on XY Graph. I need to send this graph along with 4 numerics &amp; 1 string data captured during the testing for printing. So I just thought of saving this as LVM file into a location &amp; filename of my choice &amp; read back for printing after the testing is over. &nbsp; XY Graph requires cluster of 2 elements(one is X array, one is Y array) for plotting. I tried writing only graph part alone to lvm file by builiding an array. But when I tried to read back this, it is not either reporting any error or showing the graph on the indicator. &nbsp; Hope someone can suggest me how to do. &nbsp; &nbsp; Thanks &nbsp; Kousy Dear Kousy, &nbsp; U can still plot the xy graph. Just read the lvm file, its o/p will be 1 D array. Connect this to for loop body (and do not connect any thiing to 'n' terminal of for loop) and ensure that index is enabled. Bundle the lvm data o/p with iteration counter (i) inside the for loop (i as first i/p and data as 2nd i/p to the bundle) which will make it cluster of 2 elements. Connect the o/p of bundle for loop body and ensure that indexing is ON and then to xy graph outside the for loop. Run the VI, it should work &nbsp; Hi Maurya, &nbsp; I tried out. &nbsp;But it is plotting all the 3 parameters on Y axis with index as X axis value. Moreover Index enabling is not active. The way I coded for writing lvm file &amp; reading ...

write into existing file with &quot;write to text file&quot;
Hi all,&nbsp;I have a text file that contains several lines of data (text). Now I would like to replace the first three lines with text coming from a string array.My approach is shown in WriteToFile.vi that is attached.When I am executing this vi (with an empty file), everything seems to be working fine in the first place.The file will contain the following text:oneoneonetwotwotwothreethreethreeNow, when the third element in the array is shortened (lets say to "threethr") before execution,&nbsp; the file will contain&nbsp; the following text:(the file was not emptied before execution)oneoneone twotwotwo threethrthreeHow can I avoid the last line being written? I have made many tests and I could not find a solution.One more example:Lets say we have an existing file, inside this file is:oneoneone twotwotwo three fourfourfourNow I would like to overwrite line three with "threethreethree". Therefore I execute my vi as shown in the attachment.What I get as a result is:oneoneonetwotwotwothreethreethreeurSo, the text in line four, which should not be touched, is "ur" instead of "fourfourfour". Any idea to solve this problem?What I basically need is replacing a line of a text file in a conveinient way.Thanks,Holger----LV 8.5.1 WriteToFile1.jpg: http://forums.ni.com/attachments/ni/170/327029/1/WriteToFile1.jpg WriteToFile.vi: http://forums.ni.com/attachments/ni/170/327029/2/WriteToFile.vi The remaining fourth line is there becau...

How to Write &amp; Read same field(eg Ring field) simultaneously and in same file

Write &amp; Read Binary files in a MultiChannel Con't DAQ
Hi there, &nbsp; I'm using NI-DSA 4472&nbsp;and&nbsp;the lockin startupkit(DAQmx version) but I need to modify the program so that I can record the data.&nbsp;The data type&nbsp;are DBL. &nbsp;I&nbsp;tried using 'Write to binary file.vi' and &nbsp;'Read from binary file.vi'. They are&nbsp;working&nbsp;for my test vi which is a single channel DAQ, but for MultiChannel I guess I need&nbsp;to create a header for the file. I found an example "Cont Acq&amp;Graph Voltage-To File(Binary).vi" and "Graph Acquired Binary Data.vi" but it seems they deal with unscaled data&nbsp;I32.&nbsp; &nbsp; Any suggestions or right directions you can point me to for writing a header for Multichannel DAQ with DBL data type and&nbsp;convert the binary file to a txt&nbsp;file when the data are read later by another 'Read binary file' vi. &nbsp; Thanks! &nbsp; &nbsp; MAE at Rutgers &nbsp; Chen &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; You could try using the TDMS write and read VIs instead.&nbsp; They provide a place to enter the group and channel names.&nbsp; Also, if you use a waveform data type with the TDMS write, the channel names are already included.&nbsp; I havent used the TDMS format with DBLs, but it has worked well with waveforms and it is a fast and compact file type. &nbsp; Hope this helps. --Robert Thanks, Robert. The r...

How do I read and write to the same CSV file
I want to update one field in a row for a csv file. So far my code looks something like this cf_stream = open("\\config.csv","r+") csv_file = csv.DictReader(cf_stream, ['Algorithm','LastModified']) and then I know I can do something like this for row in csv_file name = row["Algorithm"] date = row["LastModified"] now what I want is something like this if date == 0: date = os.getmtime() # now this is where I want to write into the row of the same csv file but only updating that one field How can I do this? On...

One thing that I'd like to see added to Fortran is easier ways to write CSV files. Several times I have found that the best way to solve a problem is to use a Fortran program and also some other standard package such as a spreadsheet or a DBMS. Nearly always the only common format is text files with data in comma-separated-value format, CSV. The file format is rather poorly standarized but RFC 4180 does its best to define it and this is, in practice, used by most packages with only minor variations. It's generally easy enough to read a CSV file in Fortran because the rules for list-directed input are broad enough to accept it. Unfortunately at present it takes more effort to write a CSV file because list-directed output has a number of quirks. Essentially you have to provide your own commas with an explicit format specification as otherwise the value separator might be a space or newline. I am planning to put forward for the next (minor) revision of Fortran a simpler way to write CSV files. I think all that is required is an output mode where: (a) The value separator is always a comma (except where the comma is the decimal separator in which case it should be semi-colon); (b) The optional repeat count in list-directed output is never used (in practice it seems to almost never used, but one needs to be sure it will not occur); (c) Character string values are always enclosed in a pair of double-quotes, with an embedded d...

CSV file read and Write issue
Hi, I am facing a small problem in doing this: I have a csv file with the below mentioned Oldformat and want to create another csv file with Newformat. The Oldformat of the csv file: column1-date column2-time column3-price1 column4-qty1 column5-price2 column6-qty2 2010/08/17,17:18:16.925,0.89785,2000000,0.89825,2000000 need to create another csv file with following Newformat column1-serialized date and time (basically date+time in number format so that i can convert them back to date and time format later) column2-blank column3-same as previous (price1) column4-s...

Touble reading a CSV file into Matlab
I have been trying to read a .csv file into Matlab with no luck at all. I have tried the CSVIMPORT.m routine but for some reason that only imports the first row of the file. The same happens when I try to use Matlabs "Import data..." function. The file is substantially large that the textread function is impossible -- and I only want to read three columns out of it anyway... I'm at a loss; anyone have a solution or a similar experience? Fabrice "Fabrice Kunzi" <kunzi@mit.edu> wrote in message <h5ct2o$aal$1@fred.mathworks.com>... > I have been trying to...

Hello, I am measuring data from two waveforms and I am using the "write to spreadsheet file.vi". I need to read both waves simultaneausly...but this isn't the problem!!! Afterwards, I want to compare those measurements with others from the same waves, so I have to draw them with Excel. But I do not know how my measurements were put in the spreadsheet file! Some people say they are stored like this: first 1000 points from the first wave and then 1000 from the other one... But I don't think this is right! Can someone help me?! Thanks ...

Writing the file using Write to SGL and reading the data using Read from SGL
Hello Sir, I have a problem using the Write to SGL VI. When I am trying to write the captured data using DAQ board to a SGL file, I am unable to store the data as desired. There might be some problem with the VI which I am using to write the data to SGL file. I am not able to figure out the minor problem I am facing.&nbsp; I am attaching a zip file which contains five files. 1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Acquire_Current_Binary_Exp.vi -&gt; This is the VI which I used to store my data using Write to SGL file. 2)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp...

Is it more CPU-efficient to read/write config file or read/write sqlite database?

special text or csv file to read in matlab
I want to read a csv file in the Matlab the format of the file is like this: 12,23,23,22,12\n23,23,34,34,43\n 23 23 12 12 12;12 33 22 33 44;34 34 32 12 33;.... and when i read ...... it shud come like this 23 23 12 12 12 12 33 22 33 44 34 34 32 12 33 that means C[1] = 23 12 34; C[2] = 23 33 34; like this.. Above both could be the file formats of the file with 100 hundreds of columns in a single row. Now I want to read the 1st five csv in 5 columns and next five values in the same column and it goes on like this.... But right now I am able to read only 1st five values in 1 column and then it doesn't read ahead using textscan. Can some body guide me how to read the values... "Vikas Malik" <vikasmalik22@gmail.com> wrote in message <hmgqdl$o8v$1@fred.mathworks.com>... > I want to read a csv file in the Matlab the format of the file is like this: > > 12,23,23,22,12\n23,23,34,34,43\n > > 23 23 12 12 12;12 33 22 33 44;34 34 32 12 33;.... > > and when i read ...... it shud come like this > 23 23 12 12 12 > 12 33 22 33 44 > 34 34 32 12 33 > > that means C[1] = 23 12 34; C[2] = 23 33 34; like this.. > > Above both could be the file formats of the file with 100 hundreds of columns in a single row. > Now I want to read the 1st five csv in 5 columns and next five values in the same column and it goes on like this.... > > But right now I am able to read only 1st five values in 1 column and then it do...

write file + input file + write file

Help reading in TMY3 (.csv files) data into Matlab
Hi guys, It would be greatly appreciated if I could get a quick point in the right direction, I am completely new to matlab, but have experience with C and Java. I have a program which needs to grab data given a longitude and latitude. With these 2 variable inputs, I will read this CSV file: http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/tmy3/TMY3_StationsMeta.csv And find the nearest location, returning the file number. What I really need is to get this data into an array in matlab; from there I can figure out how to find the closest location. Then the same deal with the quir...

Error in reading and writing CSV format file in python

How read/write matlab style WAV sound file?
The supplied LabVIEW WAV read/write VIs require fixed sampling rates (like 8000, 11025, 22050, 44100), and use integer data (so the waveforms take on large +/- integer values). I need to read/write WAV files that are like those used in Matlab with its wavread and wavwrite functions. Those can use ANY sample rate, and the waveforms have decimal values between -1 and +1. Could someone suggest either how to directly write these standard WAV files with an existing VI, or how to write my own VI to do this? Thanks in advance. LabVIEW uses integer PCM data for the sound data instead of a floating...

Dicom read&write for RT Structure file
Hi All, By using dicominfo command, RT structures can be successfully extracted from its dicom file. Then my question is: After I edit RT structures, how can I use dicomwrite command to write modified content back to its corresponding dicom RT structure file? I faid in the following scheme in MatlabR14SP2. RSInfo=dicominfo('RSDicom.dcm'); X=dicomread(RSInfo); dicomwrite(X, 'CreateMode', 'Copy', 'Info', RSInfo); Is there workaround to this problem? Thanks! Joy Hi All, I got the solution for writing RT Structure file. I have to say that Matlab is reall...

csv read clean up and write out to csv
Hi I have a problem with a csv file from a supplier, so they export data to cs= v however the last column in the record is a description which is marked up= with html. trying to automate the processing of this csv to upload elsewhere in a usea= ble format. If i open the csv with csved it looks like all the records aren= 't escaped correctly as after a while i find html tags and text on the next= line/record. If I 'openwith' excel the description stays on the correct line/record? I want to use python to read these records in and output a valid csv with t= he descriptions intact preferably without the html tags so a string of text= formatted with newline/CR where appropriate. So far I have this but don't know where to go from here can someone help me= ? import csv infile =3D open('c:\data\input.csv', 'rb') outfile =3D open('c:\data\output.csv', 'wb') reader =3D csv.reader(infile) writer =3D csv.writer(outfile) for line in reader: print line writer.writerow(line) The input.csv is set out as follows; HEADER ROW 1st "FileDate","ProductID","Name","StandardPrice","DropshipPrice","SRP","Brand"= ,"Xline","InStock","Stock","Barcode","Weight","CategoryID","Category","Smal= lImage","LargeImage","Description" A ...