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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:23:58+00:00 2026-06-06T14:23:58+00:00

Subscripted assignment dimension mismatch.’ when running a linprog coding. My code is for M

  • 0

“Subscripted assignment dimension mismatch.’ when running a linprog coding.

My code is

for M = 1 : size(PV_output,1)
for N = 1 : size(WT_output,2)


    f(:,M:N ) = [((CRF*CC_PV(M)/PVenergy(M)+OM_PV)); ((CRF*CC_WT(N))/WTenergy(N))+OM_WT];  % Objective function coefficients

    %A(:,:) = [-PV_output(:,:,K)  -WT_output(:,:,L)];
    A (:,M,N) = [-PV_output(:,M)  -WT_output(:,N) ];

    b(:,:)  = -Demand(:);

    lb = zeros(2,1);

    ub = [max_PV_area/PV_area; max_WT_area/WT_area]';

end
end 
[x, fval, exitflag] = linprog(f,A,b,[],[],lb,ub)

PV_output is 8760x1x27 and WT_output is 8760x1x3

I am trying to find the “f” coefficients below for all the combinations of the 27 and 3 PV and WT’s in this code
Does anyone know how to index the “f” to do so?

Thank you

  • 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-06T14:24:00+00:00Added an answer on June 6, 2026 at 2:24 pm

    Your first problem is that you need to get size of the third dimension of the matrices:

    for M = 1 : size(PV_output,3) %# <---3, not 1  
        for N = 1 : size(WT_output,3) %# <---3, not 1 
    

    Next, you don’t want (:,M:N) but rather (:,M,N)

    f(:,M,N)
    

    There is likely more. This should get you started; and use the debugger to see what sizes the dimensions of your matrices are, and make sure they are what you think they should be. For example, you can’t add matrices of different sizes together, so make sure the dimensions are the same.

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

Sidebar

Related Questions

Matlab is giving me the error, Subscripted assignment dimension mismatch however I don't think
I get an error of ??? Subscripted assignment dimension mismatch. when days value reaches
When I am running this program I am getting warning array subscript has type
I am a brand new programming student, so please forgive my ignorance. My assignment
The code below gives me error = Subscript indices must either be real positive
I'm trying to create output files subscripted by a dynamic index ( d =
I am new with C#. I am running a loop to send emails to
I am getting the Subscripted value is neither array nor pointer error on a
I'm getting this error ev.c:11: error: subscripted value is neither array nor pointer for
I am working on a school assignment that requires operator overloading. I am having

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.