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 8193483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:29:37+00:00 2026-06-07T04:29:37+00:00

I have different distribution for different time ( t ) with each distribution having

  • 0

I have different distribution for different time (t) with each distribution having 10,000 elements. I have following line of code which computes CDF for different distributions inside the loop with t varying from 1 to nT:

[f_CDF(:,t),x_CDF(:,t)]=ecdf(uncon_noise_columndata_all_nModels_diff_t(:,1,t));

Matlab’s function ecdf gives CDF values which could be less than the total number of elements in the distribution because the probability for the repeated elements gets added up. As a result, the output variables f_CDF and x_CDF run into problem of ??? Subscripted assignment dimension mismatch. error because of different length of vectors at different t.

How can I sort this problem such that NaN could fill up the places where the vector’s length is less than the maximum length of any vector in the whole matrix and I am able to implement the above line of code inside the loop. Thanks.

  • 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-06-07T04:29:39+00:00Added an answer on June 7, 2026 at 4:29 am

    Here are two of many ways to approach this problem:

    1) Use a cell array

    Consider storing the results in a cell array instead of a matrix which, by definition, requires columns to have the same length.

    [f_CDF{t},x_CDF{t}]=ecdf(uncon_noise_columndata_all_nModels_diff_t(:,1,t));
    

    2) Preallocate NaN matrices

    Before running the loop which calculates the CDF results, create a matrix filled with NaNs. You know that each column won’t be longer than 10,000 records.

    f_CDF = NaN * ones(10000, nT);
    x_CDF = NaN * ones(10000, nT);
    for t = 1:nT
        [f_CDFTemp, x_CDFTemp]=ecdf(uncon_noise_columndata_all_nModels_diff_t(:,1,t));
        f_CDF(1:length(f_CDFTemp),t) = f_CDFTemp;
        x_CDF(1:length(x_CDFTemp),t) = x_CDFTemp;
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have different blocks of 34 threads each (0...33). I need to find a
I have different urls that points to the same code www.url1.com www.url2.com I need
I have an application in which I have different activities. In 1 activity, I
We have several different optimization algorithms that produce a different result for each run.
I have written a RNG class which holds different algorithms, however it does not
I am creating a generic app which will have different builds for different customers.
I have different Bundles: MainBundle (Homepage), SecurityBundle (Login, Registration), MessageBundle (Message System), ShopBundle. I
I have different values in different classes. I need to insert them in the
I have different php output in jQuery-based tabs. This output is formed from database
I have different projects written in .NET 3.5 and some unit test projects to

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.