フィルターのクリア

how to store all the results in a table with index

3 ビュー (過去 30 日間)
bil bbil
bil bbil 2014 年 3 月 22 日
コメント済み: Jan 2014 年 3 月 23 日
hello for exmpl a=length(point);%are already stored in an array for i=1:a-2 for j=i+1:a-1 for k=j+1:a b =point(i,2)+point(j,1)+point(k,1); end end end how to store all the results in a table with 3point ( i(x,y) ,j(x,y),k(x,y))indice??
  1 件のコメント
Jan
Jan 2014 年 3 月 22 日
The code is not readable and I do not understand the question.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2014 年 3 月 23 日
I don't understand either. I don't think you need a table, though I applaud you for wanting to use this new (as of R2013b) variable type. I think a regular numerical array would be fine.
Are you trying to create a 3D variable called "b" where the x, y, and z indexes are taken from the "point" array and you just want to set it to 1 or something? Like
numberOfPoints = size(points, 1);
for l=1:numberOfPoints
row = points(k,1);
column = points(k, 2);
z = points(k,3);
b(row, column, z) = 1;
end
That's just a SWAG
Also, be aware that a=length(point) takes the longest dimension. Length() takes the longest dimension when you're using it on a multidimensional array. That's why it's safer to use size() so you know for sure what you're getting.
  3 件のコメント
Image Analyst
Image Analyst 2014 年 3 月 23 日
OK, in that kind of "round robin" type of situation then you would need 3 nested for loops. But we still don't know what your badly-named "b" is. See this:
Jan
Jan 2014 年 3 月 23 日
@bil bbil: Please note, that neither "table" nor "points" is well defined here.
Please start with formatting your code in the question. Thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by