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: Ganesh Kini
Subject: Re: Printing the values ​​on the .csv file
Date: Mon, 8 Jun 2020 22:16:25 +0200

Yes, But I don't get the condition value( as the output)  from the program. I need to map temperature to a condition in the program. how can I do it ?

On Mon, Jun 8, 2020 at 10:12 PM Andrew Janke <floss@apjanke.net> wrote:


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]