Create an app using app designer in MATLAB. The app is used to collecting data and storing the data.

4 次查看(过去 30 天)
I'm Creating an app for Collecting a data. For example: If we enter some numeric value for how many election boxes edit field, we should get that many election boxes and each election box have a serial number where the value should be entered. The each election box is filled with number of political party and for each political party how many people based on age('N' number of boxes and ask to upload excel files). Inside election box we should be able to write political party name and number of people for each political party should be in excel format.

回答(1 个)

Cris LaPierre
Cris LaPierre 2024-3-27
编辑:Cris LaPierre 2024-3-29
You will likely find the App Building Onramp extremely helpful in getting started with this project. It's free, interactive, and takes about 1 hour to complete.
  3 个评论
Vaibhavi Pallavaneni
Very sorry for the delayed relpy Cris. Here is the code. Please help
function EnterButtonPushed(app, event)
numElectionBoxes = app.NumberofElectionBoxesEditField.Value;
app.ElectionBoxes = zeros(1, numElectionBoxes);
app.Party = cell(1, numElectionBoxes);
app.People = cell(numElectionBoxes, 1);
% Get temperature values
for i = 1:numElectionBoxes
prompt = sprintf('Enter ElectionBox %d (K):', i);
app.ElectionBoxes(i) = str2double(inputdlg(prompt));
% Get number of SOC values for each temperature
numParty = str2double(inputdlg(sprintf('Enter number of Party values for ElectionBox %d:', i)));
app.PartyValues{i} = zeros(1, numParty);
app.NumPeople{i} = zeros(1, numParty);
% Get SOC values and number of cells for each SOC
for j = 1:numParty
app.PartyValues{i}(j) = str2double(inputdlg(sprintf('Enter Party value %d for ElectionBox %d (%%):', j, i)));
app.NumPeople{i}(j) = str2double(inputdlg(sprintf('Enter number of People for ElectionBox %d and Party %d:', i, j)));
end
end
% Update table
app.data = {};
for i = 1:numElectionBoxes
for j = 1:length(app.PartyValues{i})
app.data{end+1, 1} = app.ElectionBoxes(i);
app.data{end, 2} = app.PartyValues{i}(j);
app.data{end, 3} = app.NumPeople{i}(j);
end
end
app.UITable.ColumnEditable = true;
app.UITable.Data = app.data;
end
% Button pushed function: AddtotableButton
function AddtotableButtonPushed(app, event)
Temperature = app.TemperatureEditField.Value;
SOC = app.SOCEditField.Value;
Cell = app.CellEditField.Value;
nr = {Temperature SOC Cell};
app.UITable.Data = [app.data;nr];
app.data = app.UITable.Data;
end

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by