Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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]


Comments

  • 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)
    end
    end[/code]
    Then, you need another loop to repeat the same code for all the students.
Sign In or Register to comment.