Replace part of a column in a matrix with different values
Afficher commentaires plus anciens
Hi all,
I have a matrix C, its size is dependent on some non-dimensional variables I have previously defined. Initially, C has a constant value (=1) in column one, and zeros else. However, I need to redefine part of the first column in C. More specifically, I need to define the last 3/4 rows of C (represented by a dimensionless variable [LLY] ). However, when doing so I yield a non-integer value:
length_x= LLX/dx <== dx,LLX dimensionless
length_y= LLY/dy; <== dy,LLY dimensionless
C=zeros(length_y,length_x);
A=.25*LLY
C(A:LLY,1)=1;
~~~~
EDU>> LLY
LLY =
1
~~~
Where LLY represents a dimensionless length. With units, LLY has the length of 2000, I would like to redefine the values in column one for rows 500 through 2000 with a value of 1. However, because of the nature of non-dimensional variables LLY is defined to be 1.
I cannot pre-define C with dimensions (units) because the resulting matrix will be too large for Matlab, thus why I need to make it dimensionless. Any ideas how to overcome the resulting non-integer value of 0.25?
~~~~~
EDU>> A
A =
0.2500
~~~~~
Thank you in advance, Kevin
Réponse acceptée
Plus de réponses (1)
Kevin
le 14 Avr 2013
0 votes
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!