How can I manage with this numbers?

1 view (last 30 days)
I have a A=1x56 double variable.
A =
Columns 1 through 9
0.0127 0.0358 0.2141 0.2279 0.2737 0.0003 0.0282 0.0196 0.0307
Columns 10 through 18
0.2148 0.1049 0.1963 0.1725 0.0442 0.0279 0.0485 0.0659 0.0735
Columns 19 through 27
0.0285 0.0593 0.0568 0.1611 0.0540 0.4560 0.3430 0.2006 0.0439
Columns 28 through 36
0.1192 0.1400 0.0719 0.1776 1.6570 0.5565 0.6836 0.1456 0.0308
Columns 37 through 45
0.7118 0.3418 0.4893 0.3433 0.0241 0.2332 0.1560 0.0538 0.5159
Columns 46 through 54
0.0075 0.0640 0.0411 0.0219 0.0245 0.0294 1.1100 0.1268 0.2686
Columns 55 through 56
0.0543 0.0266
But In general I work with 1xn double variable. After this I have
col_A=rc1(1,2)-2;
But col_A it's simple a number: 7 for example in this case. I have to create a matrix that is an made up by 7 columns and 8 rows, in this case because the number of columns depends of the col_A value and The number of rows depends is n/col_A value. How Can I do this?
  2 Comments
Mischa Kim
Mischa Kim on 22 Feb 2014
I am not quite clear on what you are trying to do. What is rc1?
Francesco
Francesco on 22 Feb 2014
Do not consider rc1 but only col_A. It's not important rc1. It's another constant defined before in the code. I have to create another matrix from A 1x56 double. But this matrix is made up by the same element of 1x56 or 1xn in the general case. Now A is a row vector. Good, I would like to obtain also an array. I have to obtain a matrix has to be made that we need to go over again every col_A. If you do this then we have a 8x7 array. Is it clear now?

Sign in to comment.

Accepted Answer

Dishant Arora
Dishant Arora on 22 Feb 2014
Edited: Dishant Arora on 22 Feb 2014
what's rc1?? anways try this:
row_A = n/col_A;
reshape(A, row_A, [] );
  4 Comments
Francesco
Francesco on 22 Feb 2014
I can put lenght(A)for a generalization case?

Sign in to comment.

More Answers (0)

Categories

Find more on Data Distribution Plots 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!