creating different arrays on the fly

조회 수: 1 (최근 30일)
Carlos Freyre
Carlos Freyre 2011년 3월 9일
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.

채택된 답변

Matt Fig
Matt Fig 2011년 3월 9일
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
Paulo Silva
Paulo Silva 2011년 3월 10일
@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 2011년 3월 10일
@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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by