我将用英语回答您的疑问,以便更快地回复。
For your first question, you can create an object for any class that is there on the MATLAB path. For example, if the class definition is:
% ExampleClass.m
classdef ExampleClass
properties
Data
end
methods
function obj = ExampleClass(data)
obj.Data = data;
end
function data = getData(obj)
data = obj.Data;
end
end
end
It can be called inside a button callback function as:
% Callback function for a button
function ButtonPushed(app, event)
myObject = ExampleClass('Hello World');
disp(myObject.getData());
end
For your second question, since the entire column of the table are designed to hold a single data type, it is not possible to use UITable for this. But you can create a custom layout using UIGridLayout and add buttons and string as needed. Refer to the following documentation for more information:
For your third question, we can easily read Excel files and manipulate the data in MATLAB and export it back to Excel. Refer to the documentations of the following functions for more information and usage:
- "readtable" for importing an Excel file or other tabular data to MATLAB: https://www.mathworks.com/help/matlab/ref/readtable.html
- "writetable" writes to a file with the name and extension specified by filename. https://www.mathworks.com/help/matlab/ref/writetable.html
Hope this helps!