필터 지우기
필터 지우기

Insert data in a cell

조회 수: 8 (최근 30일)
baby
baby 2013년 1월 21일
hello all,,
i've problem with my code about how to insert data in a cell's column
i mean like this
f =
[1] [4] [] 'low'
[3] [4] [] 'low'
[7] [7] [] 'high'
[7] [4] [] 'high'
i want the result of my calculation --> length = ( b(:,1) - e(1,1)).^2 + (b(:,2) - e(1,2)).^2) included in the third column between [4] and 'low'
can someone help me?
i already try to fix the problem for 2 days
please help me
this is my code
a= input ('Input Number of Data :');
for c=1:a
int2 = ['Input The First Score - ',num2str(c),' :'];
int3 = ['Input The Second Score - ',num2str(c),' :'];
str = ['Input Category ke - ',num2str(c),' :'];
b(c,1) = input(int2);
b(c,2) = input(int3);
f{c,4} = input(str,'s');
end;
for d = 1 : 1
int4= ['Input The First Data :'];
int5 = ['Input The Second Data :'];
e(d,1) = input(int4);
e(d,2) = input(int5);
end;
length = ( b(:,1) - e(1,1)).^2 + (b(:,2) - e(1,2)).^2
for i = 1:size(b,1)
for j = 1:2
f{i,j} = b(i,j);
end;
end
  댓글 수: 1
Image Analyst
Image Analyst 2013년 1월 21일
length is a built-in function. Don't use length as the name of your variable.

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

채택된 답변

Thorsten
Thorsten 2013년 1월 21일
for i = 1:numel(length)
f{i, 3} = length(i);
end
  댓글 수: 1
baby
baby 2013년 1월 21일
it's working :)
thx u so much,,
but i still not find yet how to choose the 3 first lowest number
can u help me??
the reshape is not working

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

추가 답변 (1개)

Thorsten
Thorsten 2013년 1월 21일
f{2, 3} = length;
  댓글 수: 1
baby
baby 2013년 1월 21일
it's not working
the result of ur command is
[7] [7] [] 'high'
[7] [4] [4x1 double] 'high'
[3] [4] [] 'low'
[1] [4] [] 'low'
none of data in third column
please help me :)

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by