i need to write a table with cols of numbers separated by cols of strings in an excel file
5 rows with Name as string, i.e.:
Name = "&"|"&"|"&"|"&"|"&";
and numbers form calculations, i.e.:
if i write
Fout = SLM1[.,1]~Name;
ret = spreadSheetWrite(Fout, "myfile.xlsx","A1");
the cols Name turns to a [5x1] of zeros...
can you please help?
I don't know if it's the most efficient way to do this, but I've used
xlswritem to output the numeric columns and
xlswritesa to output the columns that are strings. I find
xlsmakerange() helpful in doing this.
For the sake of the example, let's say you have calculated a numerical variable
slm1[.,1] and that the strings variables are stored in a string array,
slmSA, with 5 columns.
fout = "myfile.xlsx"; /* modify this for the appropriate directory"; outrow = 1 | rows(slm1); /* modify this if you want to add a header row */ outcol = 1 | 1; outrange = xlsmakerange(outrow, outcol); chk = xlswritem(fout, outrange, 1, ""); /* should write to col A in output file, chk = 0 if failure, 1 - if successful */ outrowSA = 1 | rows(slmSA); outcolSA = 2 | (1+cols(slmSA)); chkSA = xlswriteSA(fout, outrange, 1, ""); /* should write strings to cols B -F, chksa = 0 if failure, 1 - if successful */
I think this code will work.