how to read data from different sheet of excel and use it in for loop nested with if else loop?
75 次查看(过去 30 天)
显示 更早的评论
frame50=xlsread('frame50.xlsx') k=sum(frame50,2); %sum of first frame of 50 users and then second frames sum of 50 users %frame50.xlsx has frame values in 1st sheet and time values in 2nd sheet. %e.g if row 1 and column 1 has frame 1 value in 1st sheet so it will have %its corresponding time value in sheet 2 in row 1 column 1.
for i=1:1000 if k(i)<p serve(i)=k(i)
else k(i)>p % look for frame having greater time in sheet 2. drop that frame and % add it to next row and then again add(here 49 frames left), if sum is less than p. Go to % next row. In next row now we will have 51 frames, if sum is greater % than p. Then again look for frame having greater time in sheet 2. At % the same time keep on adding the dropped frames end end
0 个评论
回答(1 个)
David Sanchez
2014-4-16
[num,txt,raw] = xlsread(filename,sheet,range) reads from the specified sheet and range.
EXAMPLE:
subsetA = xlsread('myExample.xlsx', 'sheet_name', 'B2:C3')
This reads the sheet "sheet_name" within "myExample.xlsx" from B2 to C3.
另请参阅
类别
在 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!