取消
显示结果 
搜索替代 
您的意思是: 

comparing elements in 2d array

Hi all

 

I need a solution. The problem is I have a 2-d array of numbers. I have to display a array subset such that the elements in the first row fall in the ranges provided by me through user prompt.  

0 项奖励
1 条消息(共 11 条)
8,312 次查看

Hi 049982856...,

use the index array function to get an sub array of the first row. You can connect this array (if this are numbers) directly to the in range function. You can then check with an "AND Array elements" function if all values are in range or you use a for loop to sort them out.

 

Hope it helps.

Mike

0 项奖励
2 条消息(共 11 条)
8,310 次查看

You should provide a bit more detail. Are you trying to coerce the first row and display the coerced row as an indicator? Or, are you trying to replace the row with the coerced values? Or...

 

If you just want to display the first row coerced, then you just need to use the "coerced" output of the In Range and Coerce function. That will return the values coerced to the range you specified. 

0 项奖励
3 条消息(共 11 条)
8,268 次查看

 


I need a solution. The problem is I have a 2-d array of numbers. I have to display a array subset such that the elements in the first row fall in the ranges provided by me through user prompt.

 

 

What do you mean by user prompt.Thought i will confirm before trying it

Do you mean from an input array there should be a prompt and user will input new values and if the new values are between certain range then the element will get updated else it will be ignored.Is my understanding right? 

0 项奖励
4 条消息(共 11 条)
8,261 次查看
its like i have a 2d array of numbers in increasing order. i input a number and i have to get the output array as all the elements that are less than it in the same order.( or rather get a subarray upon comparing the elements )
0 项奖励
5 条消息(共 11 条)
8,244 次查看

04998285626 wrote:
its like i have a 2d array of numbers in increasing order. i input a number and i have to get the output array as all the elements that are less than it in the same order.( or rather get a subarray upon comparing the elements )

 

Sorry, it still makes no sense.

 

  • A 2D array has two dimensions, so the word "increasing" is not cleary defined. Increasing with the row index? column index? both?
  • You cannot remove single elements from a 2D array. You can only remove entire rows or columns.
  • The term "same order" makes little sense for a 2D array

 

Please show un an example array of numbers and indicate what the solution should be.

0 项奖励
6 条消息(共 11 条)
8,241 次查看
Message Edited by muks on 08-23-2008 03:31 AM
0 项奖励
7 条消息(共 11 条)
8,217 次查看

Sorry u meantioned 2d array so is this what u want?

 

 

Message Edited by muks on 08-23-2008 03:35 AM
8 条消息(共 11 条)
8,214 次查看
If my understanding is wrong then as altenbach suggested can u diagramatically describe what ur input and ur expected output should be?
9 条消息(共 11 条)
8,211 次查看

04998285626 wrote: 
...The problem is I have a 2-d array of numbers. I have to display a array subset such that the elements in the first row fall in the ranges provided by me through user prompt.  

And...


04998285626 wrote:
its like i have a 2d array of numbers in increasing order. i input a number and i have to get the output array as all the elements that are less than it in the same order.( or rather get a subarray upon comparing the elements )

OK, let's try to interpret this once more in clearer language. Apparently, the first row has some significance.

 

Maybe only the first row is increasing in value and we want to keep the subset of the 2D containing all columns that are below a threshold in the first element. Since the values in the first row are increasing, all we need to do is find the column index where the first element is too big, and then take the subset of the 2D array up to this point. Here is a solution for this interpretation of the task.

 

You still might need to adjust for detail, e.g. use "greater or equal?" instead of "greater?" depending on your exact needs.

 

 

 

Message Edited by altenbach on 08-23-2008 11:19 AM
10 条消息(共 11 条)
8,194 次查看