Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: string extra character?

Subject: string extra character?

From: ching l

Date: 18 Jul, 2008 21:57:01

Message: 1 of 5

a= 80;
csvwrite(num2str(a), [2]);

the result = 80.dat

what can I do so that the file name can be 80_1?






Subject: string extra character?

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 18 Jul, 2008 22:20:58

Message: 2 of 5

In article <g5r3jd$s4u$1@fred.mathworks.com>,
ching l <chinglnc@hotmail.com> wrote:
>a= 80;
>csvwrite(num2str(a), [2]);

>the result = 80.dat

>what can I do so that the file name can be 80_1?

csvwrite(num2str(a,'%d_1.dat'),[2]);
--
  "If there were no falsehood in the world, there would be no
  doubt; if there were no doubt, there would be no inquiry; if no
  inquiry, no wisdom, no knowledge, no genius."
                                              -- Walter Savage Landor

Subject: string extra character?

From: ching l

Date: 18 Jul, 2008 23:05:03

Message: 3 of 5

roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g5r50a$7ro$1@canopus.cc.umanitoba.ca>...
> In article <g5r3jd$s4u$1@fred.mathworks.com>,
> ching l <chinglnc@hotmail.com> wrote:
> >a= 80;
> >csvwrite(num2str(a), [2]);
>
> >the result = 80.dat
>
> >what can I do so that the file name can be 80_1?
>
> csvwrite(num2str(a,'%d_1.dat'),[2]);
> --
> "If there were no falsehood in the world, there would be no
> doubt; if there were no doubt, there would be no
inquiry; if no
> inquiry, no wisdom, no knowledge, no genius."
> -- Walter
Savage Landor


i really can't see anything wrong with the codes below,
it has the bracket unbalanced error, but it has 4 pairs
brackets which is right....

csvwrite ((num2str(ceil(handles.randValue)),'%d_1.dat'), [1]);



Subject: string extra character?

From: matt dash

Date: 18 Jul, 2008 23:22:02

Message: 4 of 5

"ching l" <chinglnc@hotmail.com> wrote in message
<g5r7iv$aus$1@fred.mathworks.com>...
> roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> message <g5r50a$7ro$1@canopus.cc.umanitoba.ca>...
> > In article <g5r3jd$s4u$1@fred.mathworks.com>,
> > ching l <chinglnc@hotmail.com> wrote:
> > >a= 80;
> > >csvwrite(num2str(a), [2]);
> >
> > >the result = 80.dat
> >
> > >what can I do so that the file name can be 80_1?
> >
> > csvwrite(num2str(a,'%d_1.dat'),[2]);
> > --
> > "If there were no falsehood in the world, there would
be no
> > doubt; if there were no doubt, there would be no
> inquiry; if no
> > inquiry, no wisdom, no knowledge, no genius."
> > -- Walter
> Savage Landor
>
>
> i really can't see anything wrong with the codes below,
> it has the bracket unbalanced error, but it has 4 pairs
> brackets which is right....
>
> csvwrite ((num2str(ceil(handles.randValue)),'%d_1.dat'), [1]);
>
>
>



Just because you have 4 of each doesn't mean it makes
sense... you have the wrong number of arguments for your
functions. You need this:

csvwrite(num2str(ceil(handles.randValue),'%d_1.dat'), [1]);

Also the square brackets arent doing anything. Though it
seems like you want something other than "1" for your last
argument anyway... you realize this will just output a text
file with the number 1 in it, right?

Subject: string extra character?

From: ching l

Date: 19 Jul, 2008 00:06:02

Message: 5 of 5

"matt dash" <n.a@mail.com> wrote in message
<g5r8iq$im9$1@fred.mathworks.com>...
> "ching l" <chinglnc@hotmail.com> wrote in message
> <g5r7iv$aus$1@fred.mathworks.com>...
> > roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
> > message <g5r50a$7ro$1@canopus.cc.umanitoba.ca>...
> > > In article <g5r3jd$s4u$1@fred.mathworks.com>,
> > > ching l <chinglnc@hotmail.com> wrote:
> > > >a= 80;
> > > >csvwrite(num2str(a), [2]);
> > >
> > > >the result = 80.dat
> > >
> > > >what can I do so that the file name can be 80_1?
> > >
> > > csvwrite(num2str(a,'%d_1.dat'),[2]);
> > > --
> > > "If there were no falsehood in the world, there would
> be no
> > > doubt; if there were no doubt, there would be no
> > inquiry; if no
> > > inquiry, no wisdom, no knowledge, no genius."
> > > -- Walter
> > Savage Landor
> >
> >
> > i really can't see anything wrong with the codes below,
> > it has the bracket unbalanced error, but it has 4 pairs
> > brackets which is right....
> >
> > csvwrite ((num2str(ceil(handles.randValue)),'%d_1.dat'),
[1]);
> >
> >
> >
>
>
>
> Just because you have 4 of each doesn't mean it makes
> sense... you have the wrong number of arguments for your
> functions. You need this:
>
> csvwrite(num2str(ceil(handles.randValue),'%d_1.dat'), [1]);
>
> Also the square brackets arent doing anything. Though it
> seems like you want something other than "1" for your last
> argument anyway... you realize this will just output a text
> file with the number 1 in it, right?

thanks for that. Yea, I know it will just output a text file
with the number 1.

Ideally, I want to have different arrays when the function
is called everytime, something like this...

Callback 1= [1, 2, 3])
Callback 2= [Callback 1: 4, 5, 6])
Callback 3= [Callback 2: 7, 8, 9])
Callback 4 = csvwrite ('string', [callback 3+ callback 4])

that means, the last callback is collecting all the data and
output it as a text file.

not sure how to do it though......

 


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
string ching l 18 Jul, 2008 18:00:26
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
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 Disclaimer prior to use.
Related Topics