Plot the last value from each cell from excel file
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Brave A
am 26 Sep. 2022
Kommentiert: Stephen23
am 26 Sep. 2022
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 Kommentar
Stephen23
am 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.
Akzeptierte Antwort
Stephen23
am 26 Sep. 2022
Bearbeitet: Stephen23
am 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))
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Import from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!