How can i align these numbers to each cell

1 回表示 (過去 30 日間)
Jeet Shetty
Jeet Shetty 2021 年 6 月 25 日
コメント済み: Jeet Shetty 2021 年 7 月 9 日
hey guys , i have tried to number each cell in my grid but i am struggling with the alignment. It wouldbe great if someone could help or give any on how to label the nodes . I am running it on GUI
%generate where each text will go
%create the list of text
string = mat2cell(num2str((1:M*M)'),ones(M*M,1));
%insert the labels
hold (app.UIAxes, 'on')
%calculte the grid lines
grid = app.XcoordinateEditField.Value:app.LengthofcellEditField.Value:app.GridWidthEditField.Value;
grid1 = [grid;grid];
grid2 = repmat([app.XcoordinateEditField.Value;app.GridWidthEditField.Value],1,length(grid));
%plot the grid lines
hold (app.UIAxes, 'on')
hold (app.UIAxes, 'on')


Walter Roberson
Walter Roberson 2021 年 6 月 25 日
Your X and Y creation are wrong. You need to multiply the 1:M by the width of the cell (and possibly add an offset, especially if you want to center the number in the cell)
  30 件のコメント
Jeet Shetty
Jeet Shetty 2021 年 7 月 9 日
Oh cool cool , thanks. i trying to edit that ui table at the moment 😁


その他の回答 (0 件)


Help Center および File ExchangeLeast Squares についてさらに検索


Community Treasure Hunt

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

Start Hunting!

Translated by