Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1494
Number of posts: 2174

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
xlsread and isnan use? Posted by ctrlzzz on 17 Mar 2011 at 11:52 AM
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:
% 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



Report
Re: xlsread and isnan use? Posted by giug on 22 Mar 2011 at 3:03 AM
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:
tot= 0;
for i = 1:16
if isnan(a(1,i))==0 
tot = tot + a(1,i)
end
end

Then, you need another loop to repeat the same code for all the students.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.