Displaying an axis scale in mm rather than pixels
Mostra commenti meno recenti
I have written a code for image analysis that uses the number of pixels throughout to calculate lengths. Now I want to plot graphs and have my axis reading in millimetres rather than number of pixels. I have a calibration factor calculated, is there a simple way I can have axis in millimetres. I need this code to work for multiple pictures therefore using the xticks and xticklabels method would help.
Risposta accettata
Più risposte (2)
elvis okacha
il 10 Apr 2019
0 voti
Look I'm trying to implement your solution within a button program in my guitar,but I still get error that 'undefined variable 'xticks''.allitle new to Matias.is there some additional code on the use of stick and xticklabels?kindly
9 Commenti
Walter Roberson
il 10 Apr 2019
Which MATLAB release are you using? xticks() is R2016b and later. Before that you had to set the XTicks property of the axes.
elvis okacha
il 10 Apr 2019
R2015a.what do I add to looky's code to achieve the conversion?
Walter Roberson
il 10 Apr 2019
xticks = get(gca, 'XTicks');
yticks = get(gca, 'YTicks');
before the code you posted earlier.
elvis okacha
il 10 Apr 2019
Thanks.though I'm getting an error that 'there is no XTicks property on the Axes class'.ive attached a picture
Walter Roberson
il 10 Apr 2019
xticks = get(gca, 'XTick');
yticks = get(gca, 'YTick');
elvis okacha
il 10 Apr 2019
Yes I tried that already.but error then occurs on the label saying 'undefined function or variable 'xticklabels'.when I replace with 'xticklabel',I get same error
elvis okacha
il 12 Apr 2019
Any help?
Walter Roberson
il 12 Apr 2019
set() the axes XTickLabels and YTickLabels properties instead of calling xticklabels() and yticklabels()
elvis okacha
il 13 Apr 2019
Ok thanks
elvis okacha
il 10 Apr 2019
0 voti
Sorry.'looky' not 'look'
Categorie
Scopri di più su Axis Labels in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!