Why do I get error when I tried to export data out of MATLAB to excel file (EEM components)

I tried to export the data to excel file but it has error. I tried to change to xlsx but it still has the same error. I do not know why and how to solve this problem ?
Please let me know if you understand this situation. Thank you so much !
[FMax,B,C]=ModelOut(AnalysisData,3,'C:\MyParafacResults.xlsx')
Error using xlswrite (line 224)
Invoke Error, Dispatch Exception:
Source: Microsoft Excel
Description: ƒtƒ@ƒCƒ‹ 'C:\4A584310' ‚ɃAƒNƒZƒX‚Å‚«‚Ü‚¹‚ñBŽŸ‚Ì‚¢‚¸‚ê‚©‚Ì——R‚ªl‚¦‚ç‚ê‚Ü‚·B
? ƒtƒ@ƒCƒ‹–¼‚Ü‚½‚̓pƒX‚ª‘¶Ý‚µ‚Ü‚¹‚ñB
? ƒtƒ@ƒCƒ‹‚ª‘¼‚̃vƒƒOƒ‰ƒ€‚É‚æ‚Á‚ÄŽg—p‚³‚ê‚Ä‚¢‚Ü‚·B
? •Û‘¶‚µ‚悤‚Æ‚µ‚Ä‚¢‚éƒuƒbƒN‚Æ“¯‚¶–¼‘O‚̃uƒbƒN‚ªŒ»ÝŠJ‚©‚ê‚Ä‚¢‚Ü‚·B
Help File: xlmain11.chm
Help Context ID: 0
Error in ModelOut (line 38)
xlswrite(excelname,FMax,'FMax')

5 Comments

Here it is the function of ModelOut
>> help ModelOut
The ModelOut function exports the model results to an excel file.
Three sheets are created. "FMax" with the fluorescence intensity of each
component in each sample, and "Em Loadings" and "Ex Loadings" with the
spectral loadings of each component.
data: soure of data
f: number of components in model to export
excelname: name and location of the excel file to create.
Example:
[FMax,B,C]=ModelOut(AnalysisData,3,'C:\MyParafacResults.xls')
I am using Microsoft Excel 2016MSO on my computer.
I can't find ModelOut as a native matlab function nor in file exchange, which probably means it is from an external toolbox or a private function from some collegue of yours. You showed only the description, so it is nor possible to know what exactly it does. I belive the problem is likely there, you can test if you can write in excel with a native function with:
xlswrite('C:\MyParafacResults.xls',{AnalysisData})
If this works than the problem is indeed in the ModelOut function.
Thank you so much for your kindness. You are right, I used the function "ModelOut" from DOMFLuor toolbox ( I dowloaded on the website http://www.models.life.ku.dk/al_domfluor. )
MoleOut
function [FMax,B,C]=ModelOut(data,f,excelname)
%The ModelOut function exports the model results to an excel file.
%Three sheets are created. "FMax" with the fluorescence intensity of each
%component in each sample, and "Em Loadings" and "Ex Loadings" with the
%spectral loadings of each component.
%
%data: soure of data
%f: number of components in model to export
%excelname: name and location of the excel file to create.
%
%Example:
%[FMax,B,C]=ModelOut(AnalysisData,5,'C:\MyParafacResults.xls')
%Copyright (C) 2008- Colin A. Stedmon
%Department of Marine Ecology, National Environmental Research Institute,
%Aarhus University, Frederiksborgvej 399, Roskilde, Denmark.
%e-mail: cst@dmu.dk, Tel: +45 46301805
eval(['Model=','data.Model',int2str(f)]);
M =nmodel(Model);
E=data.X-M;
[A,B,C]=fac2let(Model);
BMax=max(B);
CMax=max(C);
FMax=[];
for i=(1:(data.nSample)),
FMax(i,:)=(A(i,:)).*(BMax.*CMax);
end
B=[data.Em B];
C=[data.Ex C];
xlswrite(excelname,FMax,'FMax')
xlswrite(excelname,B,'Em Loadings')
xlswrite(excelname,C,'Ex Loadings')
I tried to type your recomended code, but it still has this error. I though it maybe related to excel format or sth but it is still problematic when I type .xls csv or .xlsx

Sign in to comment.

 Accepted Answer

I solved this problem by typing:
>> [FMax,B,C]=ModelOut(AnalysisData,4,'C:/MyData/gem.xls')
I can export the data by adding a subfolder my data instead of exporting directly to C

More Answers (0)

Asked:

Gem
on 19 Apr 2020

Answered:

Gem
on 27 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!