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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:45:24+00:00 2026-06-05T11:45:24+00:00

I have a function in matlab which accepts a nx1 matrix. I have a

  • 0

I have a function in matlab which accepts a nx1 matrix.

I have a matrix X of nx2 dims

How do I send matrix X to the function where every row of X goes as an element?

  • 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-05T11:45:25+00:00Added an answer on June 5, 2026 at 11:45 am

    Have a look at this matrix indexing in MATLAB article on the MathWorks website for information and examples of indexing matrices. To select rows from a matrix you can do something like the following:

    >> m = rand(5, 2)
    
    m =
    
        0.8147    0.0975
        0.9058    0.2785
        0.1270    0.5469
        0.9134    0.9575
        0.6324    0.9649
    
    >> m(1,:)        
    
    ans =
    
        0.8147    0.0975
    
    >> m(end,:)      
    
    ans =
    
        0.6324    0.9649
    

    The first index of a matrix corresponds to the rows, the second corresponds to the columns. Here the : as the second index selects all the columns of the appropriate row. If you have a function func, and the matrix m from above you can pass each row of m to func as follows:

    for i = 1:length(m)
        func(m(1,:)')
    end
    

    Note the transpose, which converts each row of m into a 2x1 array, i.e. a column vector, rather than a row vector.

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

Sidebar

Related Questions

I have a matlab script lets say image_process.m and the function image_process accepts one
I have a function in MATLAB which takes another function as an argument. I
I have matlab function that calls a Perl script which converts a large text
In Matlab 2011b, I have a multidimensional matrix which is to be initially presented
I have a Matlab function that creates a cell array with matrixes inside. It
I have matlab file matlab_param.m function matlab_param(param1, param2) disp(sprintf('param1 : %s', param1)); disp(sprintf('param2 :
I have written the following algorithm in order to evaluate a function in MatLab
I have installed Matlab r2010a on my computer I need use the function xlsread
I have a for loop in Matlab; inside it I am calling a function
I'm looking for a Matlab function which would decompose a signal using Matching Pursuit

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.