help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Printing the values ​​on the .csv file


From: Andrew Janke
Subject: Re: Printing the values ​​on the .csv file
Date: Mon, 8 Jun 2020 16:12:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.9.0


On 6/8/20 4:09 PM, Ganesh Kini wrote:
> Temperature  Condition
> 40           Cold
> 60           warm
> 80           hot  and so on (100 values)
> 
> 
> I have a query and I am looking for a solution
> So we have 3 back-end files where for temperature 40, the condition cold
> is defined and so on and is defined based on few conditions ( conditions
> not important )
> 
> but while running the code The output that I get is only temperature
> values, So when I run the code for whichever temperature it is set(
> rather we get the output) it should print the Condition value in the
> above format
> 
> [fid, msg]   = fopen('file1.csv', 'wt' );
> fprintf (fid1, 'Temperature');
> fprintf('\n');
> 
> for
>     for
>                      ...
>             fprintf (fid, '% 3.0f \ n' , temp)
> 
>     end
> end
> 
> 
> How do i do that? please help
> 
> 

This statement:

>             fprintf (fid, '% 3.0f \ n' , temp)

is only printing a single number, temp. You need something like:

>             fprintf (fid, '%3.0f,%s\n' , temp, condition)

to print both.

Cheers,
Andrew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]