Index a percentage of a Matrix

조회 수: 1 (최근 30일)
Rob Jepp
Rob Jepp 2016년 11월 28일
편집: dpb 2016년 11월 30일
I'm trying to extract the first 85% of one matrix and the last 15% of another to enable me to plot the combustion of non regular shaped solid fuels but haven't been able to so far.

답변 (1개)

dpb
dpb 2016년 11월 28일
85% of what--the indices, the values, ...? And, if it's is a matrix, what about shape? Matter where they came from or just overall, or...????
Anyway,
  1. %age of number of elements in matrix --> x(1:round(0.85*numel(x)))
  2. elements within %age of max in matrix--> x(x<=0.85*max(x(:)))
Other logical direction readily extensible from above.
  댓글 수: 2
dpb
dpb 2016년 11월 30일
[OP Answer moved to Comment -- dpb]
Sorry they are single line matrices. Lengths will change depending of the fidelity that I require.
dpb
dpb 2016년 11월 30일
편집: dpb 2016년 11월 30일
" depending of the fidelity that I require."
What does that mean? Still don't say what it is that you mean by percentage. Give an example (minimally sized) input and an expected output and the rule(z) by which you decide that's the right answer...otherwise, what's wrong with the above?

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by