- Open your App Designer project in MATLAB.
- Click on the "Code View" button to switch to the code editor.
- In the left pane, go to the Properties section
- Click on Add and rename the property accordingly
- Save your changes.
How do I save the calculated data in the GUI and output it as a table?
2 次查看(过去 30 天)
显示 更早的评论
Hello
I am trying to make (what I thought would be) a simple and quick to make GUI for assigning values to audio processings.
What I am curious about is transferring the data created in the button callback function to the uitable.
The code I used is below.
function fittingbutton_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
Frequency_Data = [160 200 250 315 400 500 630 800 1000 1250 1600 2000 2500 3150 4000 5000 6300 8000];
Gain_Data1 = fillmissing(FIG_gain(2,Data,1),'constant',0);
Gain_Data2 = fillmissing(FIG_gain(2,Data,2),'constant',0);
Gain_Data3 = fillmissing(FIG_gain(2,Data,3),'constant',0);
Gain_Data = vertcat(Frequency_Data,Gain_Data1,Gain_Data2,Gain_Data3);
set(handles.uitable2,'Enhanced FIG6 Parameter Table', array2table(Gain_Data));
%set(handles.uitable2,'Data', Gain_Data);
end
This code does not work, and the method of saving and loading data in Excel (ex : xlswrite, xlsread) or assignin function, but it didn't work.
I want the calculated Gain_Data(4 by 18 Array) values to be output to the uitable when the fitting button is pressed.
I've spent a lot of time trying to use this method, but I can't seem to get it to work, so I'm asking for help.
Any help would be greatly appreciated, Thank you.
0 个评论
回答(1 个)
Abhishek Chakram
2023-9-26
Hi 형일 고,
It is my understanding that you are facing difficulty in storing the calculated values and displaying it in a table. In your program, you can define a property variable and assign the calculated values to it. When the fitting button is tapped, you can use the same property to set it to the table.
Here are the steps for the creating a property:
Here’s a sample code for the same:
properties (Access = private)
tableData % Description
end
% Callbacks that handle component events
methods (Access = private)
% Button pushed function: CalculateButton
function CalculateButtonPushed(app, event)
matrix = reshape(1:56, 7, 8);
app.tableData = matrix;
end
% Button pushed function: FittingButton
function FittingButtonPushed(app, event)
app.UITable.Data = app.tableData;
end
end
In this example, the tableData is a property created to store the calculated values which is later used as app.UiTable.Data when FittingButtonPushed Callback is executed.
Best Regards,
Abhishek Chakram
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!