Plot the last value from each cell from excel file
1 view (last 30 days)
Show older comments
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 Comment
Stephen23
on 26 Sep 2022
"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.
Accepted Answer
Stephen23
on 26 Sep 2022
Edited: Stephen23
on 26 Sep 2022
"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))
More Answers (0)
See Also
Categories
Find more on Data Import from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!