Getting "Unrecognized function or variable 'reshape'" error!!

33 vues (au cours des 30 derniers jours)
Kumar Vishal Rai
Kumar Vishal Rai le 26 Mai 2022
Réponse apportée : Chunru le 27 Mai 2022
I am running R2021b and using simple reshape function.
But Matlab is giving Unrecognized function or variable 'reshape'".
I checked for the path of this function and its present in the path values.
Any idea what could be wrong.
  3 commentaires
KSSV
KSSV le 26 Mai 2022
Show us the code you tried.
Kumar Vishal Rai
Kumar Vishal Rai le 27 Mai 2022
I am using following code:
reshape([1 2 3 4],:,1);
and getting the error!!

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Mai 2022
reshape([1 2 3 4],:,1);
Notice the : . : by itself can only appear (a) in comments; (b) in character vectors; (c) in string() objects; or (d) as a subscript for a variable. So in context, that code would require that "reshape" is a variable. But reshape is not a variable in your code.
Perhaps you were looking for
reshape([1 2 3 4],[],1)

Plus de réponses (1)

Chunru
Chunru le 27 Mai 2022
%reshape([1 2 3 4],:,1);
reshape([1 2 3 4], [], 1) % use [] for auto computed size
ans = 4×1
1 2 3 4

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by