Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized function or variable 'toC' #513

Open
AdamAtTrimble opened this issue Aug 16, 2024 · 4 comments
Open

Unrecognized function or variable 'toC' #513

AdamAtTrimble opened this issue Aug 16, 2024 · 4 comments

Comments

@AdamAtTrimble
Copy link

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
Copy link
Author

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
Copy link

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
Copy link

Try removing the toC call in toC(axisData.(axisName + "TickLabel"))

ex: tickLabels = axisData.(axisName + "TickLabel");

@JoaoAmaro2001
Copy link

JoaoAmaro2001 commented Oct 3, 2024

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
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants