Is it possible to extract and store data to uitable in GUI

조회 수: 1 (최근 30일)
Bastion
Bastion 2011년 9월 27일
Is it possible to extract a set of data from an equation and store it in a uitable?
I want to extract the output data from an equation to a uitable and then later on export it to excel. Not sure if the first part is possible.
My code that I'm trying to extract data:
C_0 = str2double(get(handles.Input_C_0,'String'));
v = str2double(get(handles.Input_v,'String'));
t = str2double(get(handles.Input_t,'String'));
D = str2double(get(handles.Input_D,'String'));
R = str2double(get(handles.Input_R,'String'));
t_half = str2double(get(handles.Input_t_half,'String'));
X1 = str2double(get(handles.Input_X1,'String'));
X2 = str2double(get(handles.Input_X2,'String')); %%%all user inputs
x = X1:0.1:X2;
lambda = (0.69314718)./t_half;
beta = sqrt((v./(2.*D)).^2+(lambda.*R)./D);
subA = (x-t.*sqrt((v./R).^2+(4.*lambda.*D)./R))./2.*sqrt((D.*t)./R);
subB = (x+t.*sqrt((v./R).^2+(4.*lambda.*D)./R))./2.*sqrt((D.*t)./R);
C1 = (1./2).*exp((v.*x)./(2.*D)).*(exp(-beta.*x).*erfc(subA)+exp(beta.*x).*erfc(subB)); %%%equation with sub equations
C = C1./C_0;
plot(x,(C));
C will generate a graph with values for each x, I wonder if I can put it in a uitable
  댓글 수: 2
Oleg Komarov
Oleg Komarov 2011년 9월 27일
Which equation. Please post an example in formatted code.
Bastion
Bastion 2011년 9월 27일
There's my code

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2011년 9월 27일
xlswrite('YourFile.xls', [x(:),C(:)])
  댓글 수: 5
Walter Roberson
Walter Roberson 2011년 9월 28일
If the uitable is tagged DATA_TABLE, then
UiTableHandle = findobj(0,'Tag','DATA_TABLE');
set(UiTableHandle,,'Data', data);
Bastion
Bastion 2011년 9월 29일
Sweet, it works and the Excel is in the Matlab directory, thanx for the help.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by