How do I create a Table with variable cell element
이전 댓글 표시
I am new in Matlab programming and I want to create a table whereby row 1 column 1 should hold a value within a range of 0-10, and row 1 column 2 hold a value 10.1-15 and so on. These values in the row and column cell will be based on an equation that will return the value that will fall within that range. It is such that only one cell will return a value at a time based on the input values to the equation. How will that be achieved?
댓글 수: 5
Shameer Parmar
2019년 7월 5일
So, How may values will be there in one cell ?
also, if you are saying Value within the range but how many ? 10, 15, 20 , ?
Alos please share the equation which will return the value..
Alfred Amiolemen's incorrectly accepted "Answer" moved here:
One value will be on each cell,
For instance you have a cell like this:
P1 P2 P3 P4
N1 P1*N1 P2*N1 P3*N1 P4*N1
N2 P1*N2 P2*N2 P3*N2 P4*N2
N3 P1*N3 P2*N3 P3*N3 P4*N3
N4 P1*N4 P2*N4 P3*N4 P4*N4
Cell P1*N1 should display a value, if it is between "0 -10", Cell P2*N1 should hold and display values between "10.1 -15.0" so when the value of the calculation is greater than 10 from "10.1 - 15.0" the value should display in cell P2*N1 and so on.
Cell P1*N1 can display value between 1 - 10, it can be 1 or 2 or 3 or 4 or 5 provided it is between 0 - 10. But if greater than 10 between 10 - 15, it should display in cell P2*N1 and so on.
the cells should display in form of excel cells.
The cell will just be a product of P and N.
Answers are for answering the question: you should accept the answer that best resolves your question.
Guillaume
2019년 7월 5일
@alfred, I'm afraid I don't really understand the question. Given the row vectors P = [P1, P2, P3, P4] and N = [N1, N2, N3, N4], the illustrated matrix is simply:
P .* N(:)
in any modern version of matlab. However, I don't think that's what is wanted.
Perhaps, instead of asking how to create some weird matrix, you should explain what the ultimate goal is. It sounds like you're trying to do some discretization, which is easily done in matlab.
Alfred Amiolemen
2019년 7월 5일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Downloads에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!