Unrecognized function or variable 'toC'
AdamAtTrimble opened this issue · 5 comments
AdamAtTrimble commented
I am trying to get plotly offline working with matlab 2024a and I keep encountering the error
Unrecognized function or variable 'toC'.
Error in extractAxisData (line 90)
tickLabels = toC(axisData.(axisName + "TickLabel"));
Error in updateAxis (line 76)
[xaxis, xExponentFormat] = extractAxisData(obj,axisData, 'X');
Error in plotlyfig/update (line 779)
updateAxis(obj,n);
Error in plotlyfig (line 292)
obj.update;
Error in fig2plotly (line 42)
p = plotlyfig(varargin{:});
AdamAtTrimble commented
If I switch to tag 2.5.5 the issue goes away.
The code is also quite different in extractAxisData between the two versions
JoaoAmaro2001 commented
I am also having the same problem. How should I implement your solution? Should I install version 2.2.5? It is quite weird that a function should be missing. Perhaps it can be easily created?
brburrous commented
Try removing the toC call in toC(axisData.(axisName + "TickLabel"))
ex: tickLabels = axisData.(axisName + "TickLabel");
JoaoAmaro2001 commented
I asked GPT to create the function toC and it worked. Just add it to the root dir.
function out = toC(in)
% Converts the input into a cell array
% Handles different data types appropriately
if iscell(in)
% Input is already a cell array
out = in;
elseif ischar(in) || isstring(in)
% Convert character arrays or strings to cell array of strings
out = cellstr(in);
elseif isnumeric(in)
% Convert numeric arrays to cell array of numbers
out = num2cell(in);
elseif isdatetime(in) || isduration(in)
% Convert datetime or duration arrays to cell array of strings
out = cellstr(in);
elseif iscategorical(in)
% Convert categorical arrays to cell array of strings
out = cellstr(in);
else
% If the input type is unexpected, return it as is
out = in;
end
endrobertoffmoura commented
The issue was fixed in commit f56427e