Printing the values on the .csv file
7 ビュー (過去 30 日間)
古いコメントを表示
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. I do not get the condition value from the program, I need to map the temperature to condition somewhere in the program. So when i run the code for whichever temperature it is set( rather we get the output) it should print the Condtion 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
fclose(fid);
How do i do that? please help
0 件のコメント
回答 (1 件)
dpb
2020 年 6 月 8 日
In your program you'll have to create a table of the names/categories and the breakpoints that is associated with them and then use a lookup to assign the name based on the value. You've not specified the actual logic of the association, is it <=Breakpoint, maybe?
If so, one way would be something like
tNames={'Cold,'Warm',Hot'};
tBreaks=[40, 60, 80];
...
% compute/read temperatures here...
...
conditions=interp1(tBreaks,tNames,temps,'next');
The above will need bounding elements to cover the range of possible inputs but gives general idea.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Data Import and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!