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!