error using tranpose (recieving permute error )

2 Ansichten (letzte 30 Tage)
Meetul Choudhary
Meetul Choudhary am 26 Jul. 2023
Bearbeitet: Meetul Choudhary am 28 Jul. 2023
CODE:
%% Testing Phase
load('testFeatures');
featvales=b2{1};
label=b2{2};
num_dims = max(size(featvales));
X=featvales';
Y=label';
PROBLEM:
I have to calculate the average for 2 different dimension
1st for 10 dimensional function
2nd for 30 dimensional function
ERROR :(the following error is recieved while executing the code)
Error using '
Transpose on ND array is not defined. Use PERMUTE instead.
Error in FeatureSelection (line 28)
X=featvales';
  2 Kommentare
Walter Roberson
Walter Roberson am 26 Jul. 2023
num_dims = max(size(featvales));
That is incorrect.
num_dims = ndims(featvales);
Meetul Choudhary
Meetul Choudhary am 27 Jul. 2023
still getting the same error

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 26 Jul. 2023
The error message is clear. How do you transpose a three (or more) dimension array?
a=rand(2,3);
a';
a=rand(2,3,4);
a';
Error using '
TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays.
  7 Kommentare
Fangjun Jiang
Fangjun Jiang am 27 Jul. 2023
Then you should be able to do featvales'
Meetul Choudhary
Meetul Choudhary am 28 Jul. 2023
Bearbeitet: Meetul Choudhary am 28 Jul. 2023
can you connect to me personally @mahimitulmahi1@gmail.com

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

James Tursa
James Tursa am 26 Jul. 2023
Bearbeitet: James Tursa am 26 Jul. 2023
If you are trying to transpose the initial 2D pages of your variable, you can do this:
pagetranspose(featvales)
Or this:
d = 1:ndims(featvales)
permute(featvales,[2,1,d(3:end)])
But it isn't clear if this will fix your underlying problem.
  2 Kommentare
Meetul Choudhary
Meetul Choudhary am 27 Jul. 2023
what exactly does this output gives as output?
it is showing a value for (:, :, 1, 704) to (:, :, 1000, 704)
Meetul Choudhary
Meetul Choudhary am 27 Jul. 2023
I am working on feature selection where im facing this issue in a part of code

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by