|
From: | Ganesh Kini |
Subject: | Re: Printing the values on the .csv file |
Date: | Mon, 8 Jun 2020 22:16:25 +0200 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |