Effacer les filtres
Effacer les filtres

How to find node coordinates for the provided honeycomb structure as shown in picture below

1 vue (au cours des 30 derniers jours)
Side lenght, and center must be user input.

Réponses (1)

Image Analyst
Image Analyst le 18 Juin 2023
I'm not sure the image you posted has enough resolution in the small hexagons to resolve them. If you have a much higher resolution image, it would be possible.
To get user input, modify this snippet:
% Ask user for two floating point numbers.
defaultValue = {'45.67', '78.91'};
titleBar = 'Enter values';
userPrompt = {'Enter floating point number 1 : ', 'Enter floating point number 2: '};
caUserInput = inputdlg(userPrompt, titleBar, 1, defaultValue);
if isempty(caUserInput),return,end % Bail out if they clicked Cancel.
% Convert to floating point from string.
usersValue1 = str2double(caUserInput{1})
usersValue2 = str2double(caUserInput{2})
% Check usersValue1 for validity.
if isnan(usersValue1)
% They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
% Convert the default from a string and stick that into usersValue1.
usersValue1 = str2double(defaultValue{1});
message = sprintf('I said it had to be a number.\nTry replacing the user.\nI will use %.2f and continue.', usersValue1);
uiwait(warndlg(message));
end
% Do the same for usersValue2
% Check usersValue2 for validity.
if isnan(usersValue2)
% They didn't enter a number.
% They clicked Cancel, or entered a character, symbols, or something else not allowed.
% Convert the default from a string and stick that into usersValue2.
usersValue2 = str2double(defaultValue{2});
message = sprintf('I said it had to be a number.\nTry replacing the user.\nI will use %.2f and continue.', usersValue2);
uiwait(warndlg(message));
end
  3 commentaires
Nupur
Nupur le 18 Juin 2023
Also i tried above code, it is not giving me desired output.
Image Analyst
Image Analyst le 18 Juin 2023
Why not? Did you change this line:
userPrompt = {'Enter floating point number 1 : ', 'Enter floating point number 2: '};
to
userPrompt = {'Enter side length : ', 'Enter center '};

Connectez-vous pour commenter.

Catégories

En savoir plus sur Deep Learning for Image Processing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by