Thread Subject: Writing variable name and value from matlab workspace

Subject: Writing variable name and value from matlab workspace

From: SURESH

Date: 30 Sep, 2008 06:30:04

Message: 1 of 4

Hello Frineds,

In brief, is it possible to write the variable name and its value from the matlab workspace to an excel file. I know that using “xlswrite” command, we can write the values from the workspace to an excel file. But I would like to know whether I can write the variable name as well.

Thanks,
Suresh.

Subject: Writing variable name and value from matlab workspace

From: Walter Roberson

Date: 30 Sep, 2008 14:13:38

Message: 2 of 4

SURESH wrote:

> In brief, is it possible to write the variable name and its value from the
> matlab workspace to an excel file. I know that using “xlswrite”
> command, we can write the values from the workspace to an excel file. But I
> would like to know whether I can write the variable name as well.

Only by converting the name into a value and writing it along with the other
values.

If you are using xlswrite() under MS Windows you can (I gather)
write fairly sophisticated files, but under any of the other operating systems
-effectively- in order to write a string as part of the data, you have to
convert *everything* to text before-hand, including putting in all
of the cell delimeters as part of the created text, and write out the text using
dlmwrite() with the cell delimeter set to the empty string.

Subject: Writing variable name and value from matlab workspace

From: SURESH

Date: 1 Oct, 2008 05:28:01

Message: 3 of 4

Walter Roberson <roberson@hushmail.com> wrote in message <%tqEk.2561$i84.1493@newsfe10.iad>...
> SURESH wrote:
>
> > In brief, is it possible to write the variable name and its value from the
> > matlab workspace to an excel file. I know that using “xlswrite”
> > command, we can write the values from the workspace to an excel file. But I
> > would like to know whether I can write the variable name as well.
>
> Only by converting the name into a value and writing it along with the other
> values.
>
> If you are using xlswrite() under MS Windows you can (I gather)
> write fairly sophisticated files, but under any of the other operating systems
> -effectively- in order to write a string as part of the data, you have to
> convert *everything* to text before-hand, including putting in all
> of the cell delimeters as part of the created text, and write out the text using
> dlmwrite() with the cell delimeter set to the empty string.

Hello Roberson,
Thanks for the reply.
Actually I'm working on MS Windows operating system. Could you please let me know how to convert the variable name as a value so that I can write both the name and value of the variable to an excel file.
Currently I'm usinf active server to invoke an excel server then using the DDE command I'm pring the results to the excel file.

Any help in this is highly appreciated...

Thanks,
Suresh.

Subject: Writing variable name and value from matlab workspace

From: Shanmugam Kannappan

Date: 1 Oct, 2008 05:46:01

Message: 4 of 4

Hello,
try this,

I think this will work for u.


var1=20;
xlswrite('X1.xlsx',[{'var1'};var1])

Shan...

"SURESH " <sureshkumarg@infotechsw.com> wrote in message <gbsh1c$luc$1@fred.mathworks.com>...
> Hello Frineds,
>
> In brief, is it possible to write the variable name and its value from the matlab workspace to an excel file. I know that using “xlswrite” command, we can write the values from the workspace to an excel file. But I would like to know whether I can write the variable name as well.
>
> Thanks,
> Suresh.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
code SURESH 30 Sep, 2008 02:30:07
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com