Plot the last value from each cell from excel file
1 次查看(过去 30 天)
显示 更早的评论
Hi there,
This is a following question for here:
I applied the way they suggested but I don't get the exact value! Most of the last value in each cell is 50 but I don't get that. Could you please provide me the best way to extract the last values in each cell and plot it?
max_iterations = 500;
xs = 1 : max_iterations;
N1 = importdata('transRewards_40_1_2.csv'); %new trans with modi
N1 =N1{1};
N1 = strrep(N1, '"[', "");
N1 = strrep(N1, ']"', "");
N1 = sscanf(N1, '%f, ', inf);
r1 = mean(reshape(N1,40,[]), 1);
r1 = r1';
ys_01 =r1(1:max_iterations, 1);
plot(xs, ys_01,'Color',[0.75, 0.75, 0]);
The data I mentioned in attachments
1 个评论
Stephen23
2022-9-26
"Plot the last value from each cell from excel file"
What Excel file? The file you uploaded is a text file, something that exists completely independently of MS Excel.
采纳的回答
Stephen23
2022-9-26
编辑:Stephen23
2022-9-26
"Could you please provide me the best way to extract the last values in each cell and plot it?"
Sure, I already did that sixteen days ago, here. The method I showed you works as expected, giving the complete matrix, allowing you to trivially select all of the values in the last column. Of course, if you want to use more complex, fragile approaches, that is up to you.
M = readmatrix('transRewards_40_1_2.csv', 'LineEnding',']', 'TrimNonNumeric',true)
plot(M(:,end))
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!