how to read data from different sheet of excel and use it in for loop nested with if else loop?

353 Ansichten (letzte 30 Tage)
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

Antworten (1)

David Sanchez
David Sanchez am 16 Apr. 2014
[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.

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!

Translated by