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

Error in formatPgfTickLabels with loglog plots #1125

Open
dgaylo opened this issue May 26, 2023 · 1 comment
Open

Error in formatPgfTickLabels with loglog plots #1125

dgaylo opened this issue May 26, 2023 · 1 comment

Comments

@dgaylo
Copy link

dgaylo commented May 26, 2023

Description

When I run matlab2tikz(... 'strict', true, ...) with a loglog Matlab plot I get the following error:

Unrecognized function or variable 'str'.

Error in matlab2tikz>formatPgfTickLabels (line 5651)
                tickLabels{k} = sprintf('$10^{%s}$', str);

It seems that a place holder variable str was left here:

tickLabels{k} = sprintf('$10^{%s}$', str);

Steps to Reproduce

Matlab code:

clear all
loglog([1e-2,1e2],[1e-5,1e5]);
matlab2tikz('test.tex', 'strict', true);

Full Error Message:

Unrecognized function or variable 'str'.

Error in matlab2tikz>formatPgfTickLabels (line 5651)
                tickLabels{k} = sprintf('$10^{%s}$', str);

Error in matlab2tikz>matlabTicks2pgfplotsTicks (line 5588)
    pTickLabels = formatPgfTickLabels(m2t, isNeeded, tickLabels, ...

Error in matlab2tikz>getAxisTicks (line 1611)
            matlabTicks2pgfplotsTicks(m2t, ticks, tickLabels, isAxisLog, tickLabelMode);

Error in matlab2tikz>getAxisOptions (line 1561)
    [options] = getAxisTicks(m2t, handle, axis, options);

Error in matlab2tikz>drawAxes (line 900)
    [m2t, xopts] = getAxisOptions(m2t, handle, 'x');

Error in matlab2tikz>saveToFile (line 485)
        m2t = drawAxes(m2t, relevantAxesHandle);

Error in matlab2tikz (line 337)
    m2t = saveToFile(m2t, fid, fileWasOpen);

Error in example (line 3)
matlab2tikz('test.tex', 'strict', true);
@ThexXTURBOXx
Copy link

This is due to a bug in #927. The str has not been properly changed to tickLabels{k}.
However, I cannot see why everything inside the small if statement was even necessary. In my tests, the tickLabels variable always holds the right values and not only the exponents.
Maybe, it is not necessary anymore in newer versions of MATLAB?

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

2 participants