フィルターのクリア

Why does scatter does not read a file as a parameter and how do I classify my data?

1 回表示 (過去 30 日間)
Jon Camilleri
Jon Camilleri 2015 年 11 月 25 日
コメント済み: Walter Roberson 2015 年 11 月 25 日
function [ average ] = classifyData( file )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% Written by J. Camilleri B.Sc IS&M
load(file);
%scatter(data(:,0), data(:, 1), 'o'); #debug
title('Distribution of iris data');
xlabel('sepal length | sepal width | petal length | petal width');
ylabel('numeric data');
average = mean(file);
r = file;
c = {1,2,3,4,5};
scatter(r,c,'o');
end
%References #BUG - originally written in Python.
%1. AIMotion blog - http://pythonbrasil.github.io/pythonbrasil11-site/
%using regression.
%2. Archive at ics.edu.mt/ UoM.
  2 件のコメント
Guillaume
Guillaume 2015 年 11 月 25 日
Please do not post the same question twice. Amend the original question.
As stated in the other question, learn to format your post.

サインインしてコメントする。

回答 (1 件)

Thorsten
Thorsten 2015 年 11 月 25 日
編集済み: Thorsten 2015 年 11 月 25 日
Read data
data = csvread('../../Downloads/iris_data.csv')
For a scatter plot of column 2 vs 1
scatter(data(:,1), data(:,2))
and in 3D
scatter3(data(:,1), data(:,2), data(:,3))
To separate the data in two classes using kmeans clustering:
idx = kmeans(data, 2);
Show results
ind = idx == 1; scatter3(data(ind,1), data(ind,2), data(ind,3), 'b')
hold on
ind = idx == 2; scatter3(data(ind,1), data(ind,2), data(ind,3), 'r')
  2 件のコメント
Jon Camilleri
Jon Camilleri 2015 年 11 月 25 日
編集済み: Walter Roberson 2015 年 11 月 25 日
I tried:
r = file(:,1);
c = file(:,2);
scatter(r,c,'o')
An error is displayed reading 'must supply X and Y data as first arguments'.
In any case, I would like to see a scatter plot where the columns of data are displayed in a scatter plot so I can see their distribution visually.
The columns represent:
sepal length (cm)
sepal width (cm)
petal length (cm)
petal width (cm)
This is data about measurements taken from plants.
Walter Roberson
Walter Roberson 2015 年 11 月 25 日
What is class(file), size(r)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeClassification についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by