xlsread and isnan use? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


xlsread and isnan use?

ctrlzzzctrlzzz Posts: 1Member
I'm a student currently working on a MatLab project that requires me to use xlsread to read an xls file that contains a random number of students (rows) and 16 columns (grades of homework/projects/exams/etc) and I am required analyze each students' data (one by one), keep track of each total, and ignore the data that doesn't exist using isnan. The problem is I don't know how I can use isnan and ignore the values that don't exist without changing the values that are 1 to 0. Also, we aren't allowed to use the nansum/nanprod functions either. If this doesn't make much sense, my professor provided an algorithm pseudocode which makes more sense than what I posted up there.

Here it is:
[code]% Import Data into MatLab
% type in help xlsread to see how to use this function
% you will need to know how many times you want to repeat the analysis
% run a loop, on each iteration, analyze the data of a SINGLE student
% keep track of the totals for each group of assignment (i.e. PSs, PROJs,...)
% When adding up items, make sure you neglect those that are NaN - find
% them and don't use them - use isnan[/code]


  • giuggiug Posts: 217Member
    the xlsread function put the content of the excel file in a matrix. In this way, analyse the matrix become a simple task.
    Now, you can use a for loop to analyse your data.
    i.e. for a single student, this is a way:
    [code]tot= 0;
    for i = 1:16
    if isnan(a(1,i))==0
    tot = tot + a(1,i)
    Then, you need another loop to repeat the same code for all the students.
Sign In or Register to comment.