error using reshape for a specific case

조회 수: 4 (최근 30일)
Ahmed Elayeb
Ahmed Elayeb 2023년 8월 9일
편집: Fangjun Jiang 2023년 8월 9일
the code gives a g-code for fdm prunters and it works good with all the STL files except the last two; it gives an error as shown below:
Error using reshape
Product of known dimensions, 4, not divisible into total number of elements, 2.
Error in infill_lines_rec (line 71)
c_line=reshape(c_point,4,[])';
the reshape fct is used in line 71 as below:
end
[c_point_t,~,ib] = unique(c_point,'rows');
c_point = c_point_t(accumarray(ib,1)==1,:);
c_line=[];
if ~isempty(c_point)
c_point=sortrows(c_point,1)';
c_line=reshape(c_point,4,[])';
end
c_lineout=[c_lineout;c_line];
end
if angle~=0
end
waiting for your help to make this file work. thanks

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 8월 9일
편집: Fangjun Jiang 2023년 8월 9일
reshape(1:8,4,[])
ans = 4×2
1 5 2 6 3 7 4 8
reshape(1:2,4,[])
Error using reshape
Product of known dimensions, 4, not divisible into total number of elements, 2.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by