introduction to programming with matlab - Vanderbilt University week-8 assignment 2 solutions


Using Cell Arrays

These solutions are for reference only.

It is recommended that you should solve the assignment and quiz by yourself honestly then only it makes sense to complete the course.

but if you cant figure out some part of it than you can refer these solutions

make sure you understand the solution  

dont just copy paste it

-----------------------------------------

function matrix = sparse2matrix(sparse_matrix) dimensions = cell2mat(sparse_matrix(1)); n = dimensions(1); m = dimensions(2); default = cell2mat(sparse_matrix(2)); matrix = default * ones(n, m); [~, len] = size(sparse_matrix); for i = 3:len element = cell2mat(sparse_matrix(i)); matrix(element(1), element(2)) = element(3); end end



main course : https://www.coursera.org/learn/matlab

No comments

darkmode