grabbing values from .txt to create stacked bar graph
1 回表示 (過去 30 日間)
古いコメントを表示
report_data.txt contains
I want to grab ( fgetl(fileID) ?) healthy_exposed, pus, and necrotic and create a stacked bar graph.
figure;
bar(1:3, cat(1,[healthy_exposed, pus, necrotic]), 0.5, 'stack');
% Adjust the axis limits
axis([0 4 0 100]);
% Add title and axis labels
title('Chronology of Wound Specifications');
xlabel('Date of Visit');
ylabel('Percentage');
% Add a legend
legend('Healthy', 'Infection', 'Necrotic');
But I'm not 'grabbing them' properly. How do I do that?
0 件のコメント
採用された回答
Joseph Cheng
2014 年 3 月 23 日
your fgetl(fileID) will get each line of data but you'll have to extract the data from the line. you can use the strfind(line,'=') which will give you your data for each line:
currentline = fgetl(fileID);
equalpos = strfind(currentline,'=');
linesdata = str2num(currentline(equalpos+1:end));
if your reports are consistent you can read in each line and associate the the data to the correct variable. given the specific line you could even use the eval([fgetl(fileID) ';']) such that it'll evaluate the line >>healthy_exposed = 75 ;
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!