MATLAB: Xlswrite and the single quote ‘ character

excelMATLABxlswrite

I want to add a formula to an Excel file using xlswrite but the formula has the ' character. This is giving me an error. Any suggestions to get around this?
For example, if I want to write the word " 'test " in cell A1 of Sheet1 I thought I would use:
xlswrite([foldername ExcelFileName '.xls'], {''test'},'Sheet1', 'A1');
But no, I get an error…

Best Answer

Well, post the entire error and I don't get any problem with:
xlswrite(filename, {'test'},'Sheet1','A1')
To have 'test you have to double it when using matlab strings:
xlswrite(filename, {'''test'},'Sheet1','A1')
But then on excel you won't see the ' before test... (but I expect it to be a desired result)
Oleg
Related Question