how can i get data from an Excel to app designer EDITFIELDS wit example folder and file

3 ビュー (過去 30 日間)
m.montaser sabry
m.montaser sabry 2025 年 7 月 14 日
編集済み: Stephen23 2025 年 7 月 19 日
how can i get data from an Excel to app designer EDITFIELDS wit example folder and file
  2 件のコメント
Govind KM
Govind KM 2025 年 7 月 17 日
編集済み: Govind KM 2025 年 7 月 17 日
Moved comment to answer
m.montaser sabry
m.montaser sabry 2025 年 7 月 17 日

Thank it is working thank you It is clear

サインインしてコメントする。

回答 (1 件)

Govind KM
Govind KM 2025 年 7 月 17 日
I assume you wish to read data from an Excel file, and display it in "EditField" components in MATLAB App Designer. This can be achieved by using the "readtable" function to read data from the specified Excel file within the code for your App, on App startup or in the callback for some other component.
For example, you could add an "EditField" and a "Button" to your app, with the "ButtonPushed" callback reading data from the Excel file and displaying the desired value in the "EditField" component. Here is sample code for such a callback:
function ButtonPushed(app, event)
filename = fullfile(pwd, 'mydata.xlsx'); % Specify path to the Excel file
data = readtable(filename); % Read the data from the Excel file
% Set the desired value for the Edit Field from the Excel file data
% Here the Edit Field value is set as the first element from the Name
% column
app.EditField.Value = string(data.Name(1));
end
Additional features could be included with this, such as using "uigetfile" to allow the user to select the Excel file instead of specifying the path in the App code, or adding components such as Sliders or Dropdowns to let the User select which data from the Excel file would be displayed in the Edit Field.
Kindly refer to the following documentation link for more information on the "readtable" function: https://www.mathworks.com/help/matlab/ref/readtable.html
Hope this helps!
  12 件のコメント
m.montaser sabry
m.montaser sabry 2025 年 7 月 18 日
excelfilepath = 'D:\mirror1\mirror1.xlsx';
data = readtable(excelfilepath);
columnData = data(:, 1); % Assuming column A is the first column
app.EditField.Value = strjoin(string(table2array(columnData)), newline);
%That code is working well my be it will be good for others
Thanks
m.montaser sabry
m.montaser sabry 2025 年 7 月 19 日
編集済み: Stephen23 2025 年 7 月 19 日
I solved the problem and I posted it to be available for others .
Yours answer gives only one row but I want whole rows in one column so yours advise does not match what I want
So I accept your answer but did not solve my problem.
Thank you

サインインしてコメントする。

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by