i do have GUI which solves P,EL,H, my problem if i got result in decimal values how do I interpolate the result?

조회 수: 1 (최근 30일)
i do have GUI which solves P,EL,H, my problem if i got result in decimal values how do I interpolate the result? because my program can interpolate only whole numbers such as 700,701 but not on decimal values =(
a = get(handles.input1_gamma,'String'); %GAMMA
b = get(handles.input2_h,'String'); %H
c = get(handles.input3_q,'String'); %Q
d = get(handles.input4_power,'String'); %POWER
e = get(handles.input5_eout,'String');
out = str2num(b) + str2num(e);
set(handles.total_answer,'String',out);
data = xlsread('table.xlsx')
%b = strcat(PathName,F);
[m n] = size(data)
k = get(handles.total_answer,'String')
for i = 1 : m
A = data(i); %check xa 1st row then compare value
A = int2str(A);
if A == k
n = i;
score = data(n,2)%compare sa 2nd value
clc; %clear and cmd
set(handles.equalel,'String',score);
break;
else
mHeight = [700 750 800];
mEout = [100 200 300];
mElevation = out;
outputArea = interp1(mHeight, mEout, mElevation);
set(handles.equalel,'String',outputArea);
end
end

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 10일
interp1 has no problems interpolating decimal numbers.
Comparing values by comparing their strings is... unusual. And you should not use == to compare strings: use strcmp() or equal() in case the two are different length.
  댓글 수: 1
john john
john john 2012년 1월 10일
okie thanks a lot.. i got how to use strcmp..
if ever the two table are different length how to use interp with that sir?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by