# matrix convertion needs modification

2 vues (au cours des 30 derniers jours)
MINATI PATRA le 9 Fév 2024
Commenté : MINATI PATRA le 13 Fév 2024
I want to create a matrix with entries -1, 0, and 1 but it gives only -1 and 1, how to adjust
x = [9 3.6 9; 11 3.6 9; 9 4.4 9; 11 4.4 9; 9 3.6 11; 11 3.6 11;9 4.4 11; 11 4.4 11];
% convertion to -1, 0, and 1
V = ( x(:,1) - min(x(:,1)) )/(range(x(:,1))/2) - 1; %% This line needs some modifications
% NOW convert to MATRIX (-1. 0, and 1)
% Below lines also need some modifications
X = [(x(:,1) - min(x(:,1)))/1 - 1 (x(:,2) - min(x(:,2)))/0.4 - 1 (x(:,3) - min(x(:,3)))/1 - 1]
X = 8×3
-1.0000 -1.0000 -1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000 -1.0000 1.0000 1.0000 -1.0000 -1.0000 -1.0000 1.0000 1.0000 -1.0000 1.0000 -1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
##### 3 commentairesAfficher 1 commentaire plus ancienMasquer 1 commentaire plus ancien
Dinesh le 9 Fév 2024
Please explain what you are trying to achieve!
MINATI PATRA le 9 Fév 2024
like the output of,
dBB = bbdesign(3)
%% Can be found in https://in.mathworks.com/help/stats/bbdesign.html

Connectez-vous pour commenter.

### Réponse acceptée

Matt J le 9 Fév 2024
Modifié(e) : Matt J le 9 Fév 2024
Perhaps this is what you had in mind?
x = [9 3.6 9; 11 3.6 9; 9 4.4 9; 11 4.4 9; 9 3.6 11; 11 3.6 11;9 4.4 11; 11 4.4 11];
X=rescale(x,-1,1,InputMin=min(x,[],2), InputMax=max(x,[],2) )
X = 8×3
1.0000 -1.0000 1.0000 1.0000 -1.0000 0.4595 1.0000 -1.0000 1.0000 1.0000 -1.0000 0.3939 0.4595 -1.0000 1.0000 1.0000 -1.0000 1.0000 0.3939 -1.0000 1.0000 1.0000 -1.0000 1.0000
X(abs(X)<1)=0
X = 8×3
1 -1 1 0 -1 0 1 -1 1 1 -1 0 0 -1 0 0 -1 0 0 -1 1 1 -1 1
##### 4 commentairesAfficher 2 commentaires plus anciensMasquer 2 commentaires plus anciens
MINATI PATRA le 13 Fév 2024
Déplacé(e) : Matt J le 13 Fév 2024
Here is the answer (attached pdf) to match the output.
MINATI PATRA le 13 Fév 2024
Dear Matt
Why here is an option "Moved"? I didnot get that.

Connectez-vous pour commenter.

### Catégories

En savoir plus sur String Parsing dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by