Saving the content of a cell array in different matrices automatically

I have a cell array ( for example corr{150,1}). I want to creat matrices with incrementing name automatically such as
x1
x2
x3
which x1 = corr{1,1}
x2= corr (2,1}
x150=corr{150,1}
and save x1 x2 ... x150 seperately with separate names (x1 , x2 ... x15) in order to upload in a different toolbox.

4 Comments

This is not a good idea at all. What exactly do you need to do with them for 'upload in a different toolbox'?
Any toolbox function that expects you to pass it 150 individual input arguments is not a function you should want to use!
Keep them in a cell array and you can have 1 variable that you can cleanly index into. Split them up, which, as you have found because you are asking the question, isn't trivial, and you have 150 variables to deal with, and that is only the start of your problems as you next, presumably have to refer to these 150 variables somehow...and the problems roll on and on!
Numbering variables is a sign that you are doing something wrong.
Just use indexing. Indexing is simple, neat, easy to understand, easy to debug, and very efficient (unlike what you are trying to do).
Actually I want to import them to Braph toolbox
It just knows an individual matrix.I have the data of 150 people (signal-time series) in one cell array but for importing the data into Braph I should upload 150 matrices which each of them known as a different subject in order the toolbox works correctly.
Braph toolbox? I have no idea what this is so hard to say much more. You can potentially pass them in as a comma-delimited list from a cell array as e.g.
myCellArray{:}
but it still seems like an odd function that would expect 150 individual arguments.

Sign in to comment.

Answers (1)

I just skimmed through the BRAPH toolbox documentation from this website:
There is nothing that mentions requiring lots of numbered variables. In fact the example here:
clearly shows only one input argument to the method getSubjectData, so I very much doubt that you would find it useful to have lots of numbered variables. If you are planning on running/calling BRAPH toolbox many times, then you should just use indexing (or at a pinch dynamic fieldnames).
If this is not what the toolbox requires, then please give us the exact location in its documentation where it specifies how to "upload in a different toolbox" as you originally requested.

1 Comment

Actually I want to upload my subjects as a different groups. 75 of the data are normal subjects and the rest is disorder.
In order to analyze them it must be two groups in the Braph and each of them contains the subjects separately.

Sign in to comment.

Categories

Asked:

on 20 Sep 2019

Commented:

on 20 Sep 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!