marix calculation with fixed and changing value

A=[1 2 ;
3 4;
5 6;],
B=[ 1 2 3;
4 5 6;
7 8 9;]
C=[1 2 3 4;
5 6 7 8;
9 10 11 12;]
D=[1 2 3 4 5;
6 7 8 9 10;
11 12 13 14 15;]
in matrix A,B,C,D the number of rows remain the same whereas the number of columns also get varied.
How to form the code for this condition and also how the graph can be plotted with fixed rows on the x axis and variable colums on the y axis.

답변 (1개)

Walter Roberson
Walter Roberson 2017년 11월 30일
편집: Walter Roberson 2017년 11월 30일

0 개 추천

You do not indicate how the number of columns should vary, so we will arbitrarily choose the number randomly, and choose the contents randomly
numrows = 3;
%choose number of columns
numcols = randi(flintmax-1, 1, 1);
%now fill them with something
E = randi(15, numrows, numcols);
%now plot with the fixed rows on the x axis and the variable columns on the y axis
plot(E.')

댓글 수: 3

thanks for your response but i receive the error stating Maximum variable size allowed by the program is exceeded in the command line (E = randi(15, numrows, numcols)).could you tell me how to get rid of this.
No, sorry, your question does not permit this problem to be removed.
In order to remove this problem, you would have to have a maximum limit on the number of columns, and that limit could not exceed 4.4 million per gigabyte of memory you have (assuming 3 rows.)
Your question requires any number of columns. I was already ruining the problem when I imposed an upper limit of 2^53 - 1 columns.
is it possible to have the number of columns with 5 different values to be 1:20,1:40,1:60,1:80 and 1:100 by assuming 10 rows.

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

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2017년 11월 30일

댓글:

2017년 11월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by