Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Linux Machine

Subject: Linux Machine

From: Jessica

Date: 19 Sep, 2008 20:00:04

Message: 1 of 5

Hi,

I have been running my Matlab scripts on a windows machine. I have now switched to a Linux machine and my codes aren't working anymore. The code seems to run okay with the exception of this error:

Warning: XLSREAD has limited import functionality on non-Windows platforms
or in basic mode. Refer to HELP XLSREAD for more information.


But then it is unable to write the final information with xlswrite:

??? Error using ==> xlswrite at 180
An error occurred on data export in CSV format.
Error using ==> dlmwrite at 99
The input cell array cannot be converted to a matrix.

Error in ==> BatchingROIs at 13
xlswrite ('PartOneA_Final.xls', results2, 1, 'A2');

I tried changing the code but still got an error:

csvwrite ('PartOneA_Final2.xls', results2);

??? Error using ==> dlmwrite at 99
The input cell array cannot be converted to a matrix.

Error in ==> csvwrite at 32
dlmwrite(filename, m, ',', r, c);


Any suggestions??

Subject: Linux Machine

From: Walter Roberson

Date: 19 Sep, 2008 20:11:07

Message: 2 of 5

Jessica wrote:
 
> ??? Error using ==> xlswrite at 180
> An error occurred on data export in CSV format.
> Error using ==> dlmwrite at 99
> The input cell array cannot be converted to a matrix.

On Windows machines, xlswrite() uses an ActiveX component to talk to
a real Excel instance; when that is done, complex data structures
can be transfered.

On non-Windows machines, xlswrite() is effectively the same as
csvwrite() -- and it can only write plain numeric arrays or
plain character arrays (and for character arrays, each character
is put into a separate cell!)

In order to write out the cell in csv format, you are going to
have to break down the pieces and do everything manually,
using fopen() to open the file, and using fprintf() to format
each subsection exactly the way you want it, including putting
the commas and what-not in the formats. There is an important
trick you will want to know when you do that: when given arrays
fprintf() goes down the columns, not across the rows, so you
will often find that you need to transpose the arrays you hand to
fprintf().

Subject: Linux Machine

From: Jessica

Date: 19 Sep, 2008 21:21:01

Message: 3 of 5

Walter Roberson <roberson@hushmail.com> wrote in message <dHTAk.10754$Il.10251@newsfe09.iad>...
> Jessica wrote:
>
> > ??? Error using ==> xlswrite at 180
> > An error occurred on data export in CSV format.
> > Error using ==> dlmwrite at 99
> > The input cell array cannot be converted to a matrix.
>
> On Windows machines, xlswrite() uses an ActiveX component to talk to
> a real Excel instance; when that is done, complex data structures
> can be transfered.
>
> On non-Windows machines, xlswrite() is effectively the same as
> csvwrite() -- and it can only write plain numeric arrays or
> plain character arrays (and for character arrays, each character
> is put into a separate cell!)
>
> In order to write out the cell in csv format, you are going to
> have to break down the pieces and do everything manually,
> using fopen() to open the file, and using fprintf() to format
> each subsection exactly the way you want it, including putting
> the commas and what-not in the formats. There is an important
> trick you will want to know when you do that: when given arrays
> fprintf() goes down the columns, not across the rows, so you
> will often find that you need to transpose the arrays you hand to
> fprintf().


Hi Walter,

Thanks for this information-- it's good to know.

Here is a sample (results2) of what I am trying to export in the array editor, each in a single column (6 columns total in this example):

16 'M' 10 200.9 '1,3,4' 1
1 'F' 12 300.2 '4,9,10' 2
.
.
.


I was wondering if you can provide any more specific help.

I can use fopen:

fid=fopen(results2);

And then I type:

fprint(fed, '%6', results2);

And I get the error:

??Error using --> fprintf
Function is not defined for 'cell' inputs.

Does this fprintf actually export it to a file or do I still need to use csvwrite somehow?

Thanks!

Subject: Linux Machine

From: Jessica

Date: 19 Sep, 2008 21:26:02

Message: 4 of 5

Walter Roberson <roberson@hushmail.com> wrote in message <dHTAk.10754$Il.10251@newsfe09.iad>...
> Jessica wrote:
>
> > ??? Error using ==> xlswrite at 180
> > An error occurred on data export in CSV format.
> > Error using ==> dlmwrite at 99
> > The input cell array cannot be converted to a matrix.
>
> On Windows machines, xlswrite() uses an ActiveX component to talk to
> a real Excel instance; when that is done, complex data structures
> can be transfered.
>
> On non-Windows machines, xlswrite() is effectively the same as
> csvwrite() -- and it can only write plain numeric arrays or
> plain character arrays (and for character arrays, each character
> is put into a separate cell!)
>
> In order to write out the cell in csv format, you are going to
> have to break down the pieces and do everything manually,
> using fopen() to open the file, and using fprintf() to format
> each subsection exactly the way you want it, including putting
> the commas and what-not in the formats. There is an important
> trick you will want to know when you do that: when given arrays
> fprintf() goes down the columns, not across the rows, so you
> will often find that you need to transpose the arrays you hand to
> fprintf().


I would also be willing to copy and paste from the array editor into a program that would preserve the structure of the contents, if this is an option!

Subject: Linux Machine

From: Jessica

Date: 21 Sep, 2008 03:13:09

Message: 5 of 5

I believe I found a work-around to this issue for those that are interested. I can save the variables on the Linux machine and then open them up on a PC machine. I am then able to xlswrite them on the PC machine.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us