Department of Computer Sciencehttps://www.univ-soukahras.dz/en/dept/cs |
0 votes
|
Given the following dataset in Matlab, Write a function in Matlab to find the different classes and number of instances per class: data=[ |
Asked on 11:12, Monday 18 Nov 2019 By Imed BOUCHRIKA |
Answers (1)
Answer (1)
0 votes
|
1/ the function ============================================ function [classes, instancesN] = findClasses(dataset) m_map = containers.Map(); [rows, columns] = size(dataset); for i=1:rows if m_map.isKey(dataset{i,1}) m_map(dataset{i,1}) = m_map(dataset{i,1})+1; else m_map(dataset{i,1}) = 1; end end classes = m_map.keys(); instancesN = m_map.values(); for k=1:length(classes) ============================================= Execution:
|
Answered on 16:41, Monday 18 Nov 2019 by abdennour redjaibia (282 points) |