Matlab : Function handle givin array to cell array of function handles

In summary, the speaker is seeking help converting a function handle that outputs an array of doubles into a cell array of function handles, each giving a component of the original array. They are unable to find a solution through Google or the MATLAB documentation and are requesting specific code to address their issue.
  • #1
espen180
834
2
Hi.

I am currently in a situation where I have a function handle giving as putput an array of doubles. I would like to convert this to a cell array of function handles, each giving a component of the previous array.

The original function handle is produced by a built-in MATLAB function, so I don't see an easy way of redefining the function to give me what I want, but maybe there is a trick I am not aware of?

So far, google and the MATLAB documentation have not been of any help.

Any help would be greatly appreciated!
 
Physics news on Phys.org
  • #2
This isn't enough information; show some code so we can see *specifically* what's going on.
 

1. What is a function handle in Matlab?

A function handle in Matlab is a variable that stores a reference to a function. It allows you to manipulate and pass functions as arguments to other functions.

2. How do I create a function handle in Matlab?

To create a function handle in Matlab, you can use the @ symbol followed by the name of the function. For example, if you have a function called "myFunction", you can create a function handle by using @myFunction.

3. What is an array of function handles in Matlab?

An array of function handles in Matlab is a collection of function handles stored in a single variable. This can be useful for performing operations on multiple functions at once.

4. How do I convert an array of function handles to a cell array in Matlab?

You can use the cellfun function in Matlab to convert an array of function handles to a cell array. This function applies a specified function to each element in the array and returns a cell array containing the results.

5. Can I pass an array of function handles as an argument to a function in Matlab?

Yes, you can pass an array of function handles as an argument to a function in Matlab. This allows you to easily perform operations on multiple functions within a single function.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
802
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
985
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
Back
Top