To put value in the specific column of uitable
Show older comments
A uitable is constructed like this:
a=[1 2 3 0;1 2 4 5;0 9 7 0;1 3 4 6]; a=num2cell(a)
First the matrix is like this:
1 2 3 0
1 2 4 5
0 9 7 0
1 3 4 6
Therefore I need to construct the code based on the algorithm below:
1.In first row, I need to check either the value in end column is zero or not. If the value is zero,I need to shift the end column into previous column. If the element is zero again,the operation will proceed again, else the end column will fix.
2. In the end column, the value 55 will replace the current value.
3. This process will proceed to next row.
Finally,the matrix will become like this:
1 2 55 0
1 2 4 55
0 9 55 0
1 3 4 55
I need help to solve this problem. Thank you very much for your concern.
4 Comments
Walter Roberson
on 20 Dec 2011
I don't see what this has to do with Genetic Algorithm and Direct Search Toolbox ??
When you say that the elements are to be shifted, do you mean a circular shift, in which all the columns move one place to the left and what was the former first column moves to the last column? If so then see circshift()
yue ishida
on 20 Dec 2011
Walter Roberson
on 20 Dec 2011
So the rule is just "Change the last non-zero entry in the column to the value 55" ?
yue ishida
on 20 Dec 2011
Accepted Answer
More Answers (0)
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!