Getting error in using code num2cell

Hi
I am using MATLAB 2022b, reinstalled on a new computer. Howver, the code that previously is not wokring and issue is that when it reaches the command of num2cell, it gives me this error ""Incorrect number or types of inputs or outputs for function 'num2cell.
I am not able run any of the example on the page and get the same error. I appreciate the help!
Best regards
Nader

3 comentarios

Dyuman Joshi
Dyuman Joshi el 10 de Abr. de 2023
Which particular example are you running?
And what is your code?
Nader Virk
Nader Virk el 10 de Abr. de 2023
I get the error when I use this function:
function [TableNo] = GenTable(TableNo,Tablefile,Tablesheet, ColumnCaps,RowCaps)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
% Give the Table to be exported
% Give row titles
% Give column titles
% Give file and sheet name as strings
% Also provide the list of coloumn and row captions
Table1=round(TableNo,3);
Table1=array2table(Table1);
end
%% However, this code is working fine for others but not for me and when it comes to examples for the mat2cell function it does not work for any of the examples when command is mat2cell.
Thanks
Nader
Nader Virk
Nader Virk el 10 de Abr. de 2023
Apologies, I meant num2cell in my reply not mat2cell

Iniciar sesión para comentar.

 Respuesta aceptada

Run this from a script or your Command Window —
which num2cell -all
/MATLAB/toolbox/matlab/datatypes/cell/num2cell.m /MATLAB/toolbox/parallel/parallel/@codistributed/num2cell.m % codistributed method
It should return something similar to this. If it returns anything else (specifically anything not in the ‘MATLAB/toolbox’ subdirectory), that could point to the problem.
.

4 comentarios

Nader Virk
Nader Virk el 10 de Abr. de 2023
Thanks for your reply. When I run the command, it returns what you noted above.
This is rather confusing because this code was working fine but running it on to my latest machine brings this issue.
Star Strider
Star Strider el 10 de Abr. de 2023
My pleasure!
That was my initial assumption, however there may be a path problem.
Run these from a script or your Command Window —
restoredefaultpath
rehash toolboxcache
and then try the code that throws the error.
If the error persists after that, Contact Support.
Nader Virk
Nader Virk el 11 de Abr. de 2023
Appreciated, I also considered this issue, did not get around as elegantly as you noted above :). But yes issue was of path - somehow defualtpath was lost!
Star Strider
Star Strider el 11 de Abr. de 2023
As always, my pleasure!
I’m glad you got that sorted!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Centro de ayuda y File Exchange.

Productos

Versión

R2022b

Preguntada:

el 10 de Abr. de 2023

Comentada:

el 11 de Abr. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by