Borrar filtros
Borrar filtros

Dimension Disagree issue ?

1 visualización (últimos 30 días)
shawin
shawin el 31 de Mzo. de 2022
Comentada: shawin el 4 de Abr. de 2022
Hi,
I have the code below :
% 2D Data
sample1 = [ ( 75.2 - 32 ).*rand( 1, 20 ) + 32, ...
( 60 - 20 ).*rand( 1,20 ) + 20, ...
( 15 -( -3.4 ) ).*rand( 1, 20 ) + ( -3.4 )
]';
sample2 = [ ( 19.2 - 1 ).*rand( 1,20 ) + 1, ...
( -10 - ( -42.5 ) ).*rand( 1,20 ) + ( -42.5 ), ...
( 20.4 - ( -5 ) ).*rand( 1,20 ) + ( -5 )
]';
inputs = [ sample1, sample2 ];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nClusters=3;
fuzzification=2;
[nInputs, nInputSamples ] = size( inputs );
% Number of Clusters
nC = nClusters;
% fuzzification parameter
m = fuzzification;
% Generate the random association of inputs to the clusters, values [ 0, 1 ]
n = rand( nInputs, nC );
nTotal = sum( n, 2 );
RandomAssociationValues = ( n./nTotal );
when i run it , i recieved an error which is :
kindly , how can i fix this issue???
Error using ./
Matrix dimensions must agree.

Respuesta aceptada

Chunru
Chunru el 31 de Mzo. de 2022
Your code can run without issue as show below.
Try "clear all;" before running the code. Or you can step through your code to see where the code goes wrong.
% 2D Data
sample1 = [ ( 75.2 - 32 ).*rand( 1, 20 ) + 32, ...
( 60 - 20 ).*rand( 1,20 ) + 20, ...
( 15 -( -3.4 ) ).*rand( 1, 20 ) + ( -3.4 )
]';
sample2 = [ ( 19.2 - 1 ).*rand( 1,20 ) + 1, ...
( -10 - ( -42.5 ) ).*rand( 1,20 ) + ( -42.5 ), ...
( 20.4 - ( -5 ) ).*rand( 1,20 ) + ( -5 )
]';
inputs = [ sample1, sample2 ];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nClusters=3;
fuzzification=2;
[nInputs, nInputSamples ] = size( inputs );
% Number of Clusters
nC = nClusters;
% fuzzification parameter
m = fuzzification;
% Generate the random association of inputs to the clusters, values [ 0, 1 ]
n = rand( nInputs, nC );
nTotal = sum( n, 2 )
nTotal = 60×1
1.5271 1.6793 1.5102 1.7007 1.6301 1.6533 1.1795 1.5919 2.6963 1.5790
RandomAssociationValues = ( n./nTotal );
  2 comentarios
shawin
shawin el 31 de Mzo. de 2022
Editada: shawin el 31 de Mzo. de 2022
No, the error is with :
RandomAssociationValues = ( n./nTotal );???
Error using ./
Matrix dimensions must agree.
Matlab version is : 2016a
shawin
shawin el 4 de Abr. de 2022
The code is working with Matlab 2022

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by