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.

2 vues (au cours des 30 derniers jours)
[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 commentaires
Rik
Rik le 23 Avr 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?
Shrutidat
Shrutidat le 24 Avr 2022
Yes sir now this editing is fine for me. can u pls do the same for the provided answer?

Connectez-vous pour commenter.

Réponse acceptée

VBBV
VBBV le 10 Avr 2022
Modifié(e) : Jan le 20 Mai 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 commentaires
Jan
Jan le 20 Mai 2022
@Shrutidat: You are aware that the original versions are still stored in the caches of the internet search engines?
Shrutidat
Shrutidat le 20 Mai 2022
Sir thank u so much 😭😭 And I'm really sorry for all the trouble 🥺

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by