i have 300 sheets in one worksheet in excel. i wan to import this to matlab. I want to create loop where it reads all sheets and plot graph on a same graph.
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Shrutidat
el 10 de Abr. de 2022
Comentada: Shrutidat
el 20 de Mayo de 2022
[num,txt,raw] = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx');
Patients = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx','150','A7:A26'); %% X-axis constant for all plots
C1 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '150', 'D53:D72'); %% Cancer patients data Y axis of run number 150 (150 sheet name)
H1 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '150', 'E53:E72'); %%heart prob data y axis of run no 150 (150 sheet name)
L1 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '150', 'G7:G26'); %% Liver prob values
B1 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx' , '150', 'H7:H26); %% Bones values
K1 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '150' 'I7:I26'); %% Kidney values ..same for next sheet 151asfollows
C2 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '151', D53:D72'); next sheet in same workbook (151)
H2 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '151', E53:E72'); 151 Sheet no
L2 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '151', 'G7:G26');
B2 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '151', 'H7:H26');
K2 = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\medicaldatasheet.xlsx', '151', 'I7:I26'); same range goes for all the sheets in workbook.
plot(patients,C1)
hold on
plot(patients,C2)
hold off
plot(patients,H1)medicaldatasheet
hold on
plot(patients,H2)
plot(patients,B1)
hold on
plot(patients,B2)
hold off
plot(patients,L1)
hold on
plot(patients,L2)
hold off
plot(patients,K1)
hold on
plot(patients,K2)
hold off
I need all this 5 plots patients Vs C, CD vs patients Vs H, patients Vs B ,patients Vs L, patients Vs K just by mentioning the sheet numbers. for eg as mentioned above 150,151 sheets i want both the values of patients Vs C to be plotted in same graph so used hold on.
3 comentarios
Rik
el 23 de Abr. de 2022
As I posted in my previous comment: if you disagree with my assessment, contact Mathworks support. I don't see anything that could be considered confidential. Can you explain which parts would be confidential? Can you think of any way to edit your question that would remove the confidential parts, but leave the essence of the question the same?
Respuesta aceptada
VBBV
el 10 de Abr. de 2022
Editada: Jan
el 20 de Mayo de 2022
hold all
for I = 1:length(num)
A(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx',num2str(I),'A7:A26');
B(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx', num2str(I), 'D53:D72');
C(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx', num2str(I), 'E53:E72');
D(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx',num2str(I), 'G7:G26');
E(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx', num2str(I), 'H7:H26');
F(:,I) = xlsread('C:\Users\varun\OneDrive\Desktop\New folder\asd.xlsx', num2str(I), 'I7:I26');
figure(1)
plot(A(:,I),B(:,I)) % coefficient for all 300 sheets
figure(2)
plot(A(:,I),C(:,I)) % coefficient for all 300 sheets
figure(3)
plot(A(:,I),D(:,I)) %
figure(4)
plot(A(:,I),E(:,I))
figure(5)
plot(A(:,I),F(:,I))
end
4 comentarios
Jan
el 20 de Mayo de 2022
@Shrutidat: You are aware that the original versions are still stored in the caches of the internet search engines?
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!