creating different arrays on the fly

1 view (last 30 days)
I have an 1500 x 200 array and want to create arrays for some columns that would have different name. The new array name should be a composition of text and array's column number. Then I want to place the data from the specific column of the original array into the new array with the same column name.
For example: Take the data in 5th column of the original 1500 x 200 array and programaticaly put it into an array called "col5". Then do it for column 10, column 12, etc.
Any help would be greatly appreciated.

Accepted Answer

Matt Fig
Matt Fig on 9 Mar 2011
Just in case you didn't read the link Paulo gave, DON'T DO THIS!
You will end up way too many variables, then you will be asking questions like, "How can I find the average of my many many arrays?" or "How can I do XX with all of these arrays?" Instead use a cell array or keep them in the array they are in already. Why complicate things?
  12 Comments
Paulo Silva
Paulo Silva on 10 Mar 2011
@Matt Tearle, it was not a flame war, just someone commented "-1 vote" on my answer, don't really know if that person was able or not to vote down my answer but it was kind of rude after the trouble I had to come up with code to do what was asked for and to provide a link for the proper way to do it, Matt Fig posted his answer after mine has you can see "Just in case you didn't read the link Paulo gave, DON'T DO THIS!...", my answer was the one accepted but I decided to remove it.
I won't make more suggestions, had enough problems, the only thing that should change is the way people think, if you don't agree with something just say why instead of voting down.
Jan
Jan on 10 Mar 2011
@Paulo: "The only thing that should change is the way people think"?! I'm sure that MATLAB Answers users do not want their way of thinking to be changed.
In fact, "-1 vote" is not a flame war. It is not very helpful, but simply the expression of a opinion deviating from yours. "-1E6 votes" would be another story.
@Matt: "The rest is just fluff". I asked Leo to translate this: "Der Rest ist Flockenbrennstoff". Ok. I have nothing to add.

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!