|
From: | Andy Buckle |
Subject: | Re: how to strip carriage return or linefeed from a string |
Date: | Tue, 4 Dec 2012 12:22:54 +0000 |
Well, there is a number of ways.
----- Original Message -----
> From: Hugo Coolens <address@hidden>
> To: address@hidden
> Cc:
> Sent: Tuesday, December 4, 2012 11:52 AM
> Subject: how to strip carriage return or linefeed from a string
>
> I'm looking for a way to put two strings one representing a current
> and one representing a voltage next to each other in a file. The
> following is a code fragment:
>
> usbtmc_write(fd,"MEAS:CURR?");
> resultcurr = char(usbtmc_read(fd,readbytes))
> strrep(resultcurr,'\n','')
> usbtmc_write(fd,"MEAS:VOLT?");
> resultvolt = char(usbtmc_read(fd,readbytes))
> fprintf(file_id, '%s' , [resultcurr resultvolt])
>
> I now get the following output in my outputfile
> 0.0249128
> 0.252767
>
> But I want:
> 0.0249128 0.252767
>
> Can anyone here solve this?
>
> thanks
> Hugo
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
>
You can delete the last character in a string. e.g. this way:
foo = bar(1:end-1);
.
You can use regular _expression_.
Regards,
Sergei.
[Prev in Thread] | Current Thread | [Next in Thread] |