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
Vaibhavi Pallavaneni 2024년 3월 29일
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