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

  • Home
  • SEARCH
  • 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 826307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:23:44+00:00 2026-05-15T03:23:44+00:00

I am trying to cluster a Matrix (size: 20057×2).: T = clusterdata(X,cutoff); but I

  • 0

I am trying to cluster a Matrix (size: 20057×2).:

T = clusterdata(X,cutoff);

but I get this error:

??? Error using ==> pdistmex
Out of memory. Type HELP MEMORY for your options.

Error in ==> pdist at 211
    Y = pdistmex(X',dist,additionalArg);

Error in ==> linkage at 139
       Z = linkagemex(Y,method,pdistArg);

Error in ==> clusterdata at 88
Z = linkage(X,linkageargs{1},pdistargs);

Error in ==> kmeansTest at 2
T = clusterdata(X,1);

can someone help me. I have 4GB of ram, but think that the problem is from somewhere else..

  • 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-15T03:23:44+00:00Added an answer on May 15, 2026 at 3:23 am

    As mentioned by others, hierarchical clustering needs to calculate the pairwise distance matrix which is too big to fit in memory in your case.

    Try using the K-Means algorithm instead:

    numClusters = 4;
    T = kmeans(X, numClusters);
    

    Alternatively you can select a random subset of your data and use as input to the clustering algorithm. Next you compute the cluster centers as mean/median of each cluster group. Finally for each instance that was not selected in the subset, you simply compute its distance to each of the centroids and assign it to the closest one.

    Here’s a sample code to illustrate the idea above:

    %# random data
    X = rand(25000, 2);
    
    %# pick a subset
    SUBSET_SIZE = 1000;            %# subset size
    ind = randperm(size(X,1));
    data = X(ind(1:SUBSET_SIZE), :);
    
    %# cluster the subset data
    D = pdist(data, 'euclid');
    T = linkage(D, 'ward');
    CUTOFF = 0.6*max(T(:,3));      %# CUTOFF = 5;
    C = cluster(T, 'criterion','distance', 'cutoff',CUTOFF);
    K = length( unique(C) );       %# number of clusters found
    
    %# visualize the hierarchy of clusters
    figure(1)
    h = dendrogram(T, 0, 'colorthreshold',CUTOFF);
    set(h, 'LineWidth',2)
    set(gca, 'XTickLabel',[], 'XTick',[])
    
    %# plot the subset data colored by clusters
    figure(2)
    subplot(121), gscatter(data(:,1), data(:,2), C), axis tight
    
    %# compute cluster centers
    centers = zeros(K, size(data,2));
    for i=1:size(data,2)
        centers(:,i) = accumarray(C, data(:,i), [], @mean);
    end
    
    %# calculate distance of each instance to all cluster centers
    D = zeros(size(X,1), K);
    for k=1:K
        D(:,k) = sum( bsxfun(@minus, X, centers(k,:)).^2, 2);
    end
    %# assign each instance to the closest cluster
    [~,clustIDX] = min(D, [], 2);
    
    %#clustIDX( ind(1:SUBSET_SIZE) ) = C;
    
    %# plot the entire data colored by clusters
    subplot(122), gscatter(X(:,1), X(:,2), clustIDX), axis tight
    

    dendrogram
    clusters

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

Sidebar

Related Questions

I'm trying to cluster some documents according to a tf-idf matrix using python. First
I am getting error no more tables permitted in this cluster when trying to
I am trying to get our DBA's to enable DTC on a cluster of
I have been trying to get Markers to Cluster on a Google map for
i'm trying to get working an old rails 2.1 application configured with mongrel cluster.
I am trying to get CUDA5 to work on a shared cluster. When I
I'm struggling trying to cluster 50 markers using the markerclusterer v3 with Google maps
I have a coherence 3.7 cluster. I am trying to connect to it using
Trying to set up a cassandra cluster, but it tells me that I have
I'm trying to describe my cache cluster nodes in AWS Elasticache. I am using

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.