Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:10:08+00:00 2026-05-26T02:10:08+00:00

Leading on from a previous question FCM Clustering numeric data and csv/excel file Im

  • 0

Leading on from a previous question FCM Clustering numeric data and csv/excel file Im now trying to figure out how to take the outputed information and create a workable .dat file for use with clustering in matlab.

    %# read the list of features
fid = fopen('kddcup.names','rt');
C = textscan(fid, '%s %s', 'Delimiter',':', 'HeaderLines',1);
fclose(fid);

%# determine type of features
C{2} = regexprep(C{2}, '.$','');              %# remove "." at the end
attribNom = [ismember(C{2},'symbolic');true]; %# nominal features

%# build format string used to read/parse the actual data
frmt = cell(1,numel(C{1}));
frmt( ismember(C{2},'continuous') ) = {'%f'}; %# numeric features: read as number
frmt( ismember(C{2},'symbolic') ) = {'%s'};   %# nominal features: read as string
frmt = [frmt{:}];
frmt = [frmt '%s'];                           %# add the class attribute

%# read dataset
fid = fopen('kddcup.data','rt');
C = textscan(fid, frmt, 'Delimiter',',');
fclose(fid);

%# convert nominal attributes to numeric
ind = find(attribNom);
G = cell(numel(ind),1);
for i=1:numel(ind)
    [C{ind(i)},G{i}] = grp2idx( C{ind(i)} );
end

%# all numeric dataset
M = cell2mat(C);

I have several types of data which looks like this:

enter image description here

I tried the below method to create a .dat file but came up with the error:

>> a = load('matlab.mat');
>> save 'matlab.dat' a -ascii
Warning: Attempt to write an unsupported data type
to an ASCII file.
    Variable 'a' not written to file. 
>> a = load('data.mat');
>> save 'matlab.dat' a -ascii
Warning: Attempt to write an unsupported data type
to an ASCII file.
    Variable 'a' not written to file. 
>> save 'matlab.dat' a 
>> findcluster('matlab.dat')
??? Error using ==> load
Number of columns on line 1 of ASCII file
C:\Users\Garrith\Documents\MATLAB\matlab.dat
must be the same as previous lines.

Error in ==> findcluster>localloadfile at 471
       load(filename);

Error in ==> findcluster at 160
       localloadfile(filename, param);

Matlabs clustering tool works on multi-dimensional data sets, but only displays on two
dimensions. You then use the x and y axis to compare against but im not quite sure if I will be able to create a clustering 2d analysis from the current data?

What I need to do is normalize the m file from my previous post FCM Clustering numeric data and csv/excel file

To normalize the data:

  1. find the minimum and maximum dataset

  2. Normalized scale minimum and maximum

  3. Number in the data set

  4. Normalized value

So first question is how do I find the minimum and maximum numbers in my dataset(m)

Step 1:
Find the largest and smallest values in the data set and represent them with the variables capital A and capital B:

Lets say minimum number A = 92000 
and max number say B = 64525000

Step 2 normalize
Identify the smallest and largest numbers and set the variables to lower case a and b
unsure how to do this in matlab (not sure how you normalize the data to start with)

set the minimum = a = 1
set the maximum = b = 10

step 3
calculate the normalized value of any number x using the equation

A = 92000
B = 64525000
a = 1
b = 10
x = 2214000

a + (x - A)(b - a)/(B - A)
1+(2214000 - 92000)(10-1)/(6425000 - 92000)
= 4.01
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:10:09+00:00Added an answer on May 26, 2026 at 2:10 am

    Looking at the errors in the middle of your question. a = load(matfile) returns a structure, which is not supported by the ASCII-based MAT-file format. Try reading the documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Leading on from my previous questions I am going to try and clarify one
I am continuing on from a previous question relating to loading instances of plugins
Currently I am loading data from a previous session into my application using the
I'm quoting myself on a previous question I asked to further explain: I'm trying
I tried using the example code from my previous question . However I get
I followed the example from a previous question and I am loading an external
I'm trying to sort an array, from a previous post I was pointed to
I need to strip leading spaces from a column in Oracle. I've Googled but
How can I separate the leading letter from the trailing number in each of
What mysql functions are there (if any) to trim leading zeros from an alphanumeric

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.