Drop Down GUI matlab [closed] - matlab

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
function DoneButtonPushed(app, event)
assignin('base','roll_no_GUI1',app.StudentInfoDropDown.Value);
assignin('base','projname_GUI1',app.ProjectInfoDropDown.Value);
assignin('base','roll_no_GUI2',app.StudentInfoDropDown_2.Value);
assignin('base','projname_GUI2',app.ProjectInfoDropDown_2.Value);
assignin('base','roll_no_GUI3',app.StudentInfoDropDown_3.Value);
assignin('base','projname_GUI3',app.ProjectInfoDropDown_3.Value);
assignin('base','roll_no_GUI4',app.StudentInfoDropDown_4.Value);
assignin('base','projname_GUI4',app.ProjectInfoDropDown_4.Value);
assignin('base','roll_no_GUI5',app.StudentInfoDropDown_5.Value);
assignin('base','projname_GUI5',app.ProjectInfoDropDown_5.Value);
closereq
end
Hi, I am creating a GUI which contains DropDowns. They are 10 dropdowns as you can see from the code. And I am using assignin to save each one of them into base workspace. But I would like to club all of them into a 2 char array's or 2 cell array's and send only two variables into the base workspace viz, Roll_nos and Projnames_GUI

Create two cell arrays and assign them in the base workspace:
roll_nos = {
app.StudentInfoDropDown.Value,
app.StudentInfoDropDown_2.Value,
app.StudentInfoDropDown_3.Value,
app.StudentInfoDropDown_4.Value,
app.StudentInfoDropDown_5.Value
};
projnames_gui = {
app.ProjectInfoDropDown.Value,
app.ProjectInfoDropDown_2.Value,
app.ProjectInfoDropDown_3.Value,
app.ProjectInfoDropDown_4.Value,
app.ProjectInfoDropDown_5.Value
};
assignin('base','Roll_nos',roll_nos)
assignin('base','Projnames_GUI',projnames_gui)

Related

How can I get a count of Sublist inside list in scala? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I have a List(List(15,21),List(10,18))
I want to get first count of total subList //here is 2
I want to get only last subList // List(10,18)
I am new in scala.
Does anyone help which approach is good here.
you can do this:
val listOfList = List(List(15,21),List(10,18))
val size = listOfList.length // 2
val lastList = listOfList.last // List(10,18)

How do I sort an array of an array in Swift 5 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
For example I have
[
["A",1]
["B",5]
["C",3]
]
How do i sort it so that it returns in Highest to lowest value B, C, A
You can do in following way:
a.sort {
return $0.last as! Int > $1.last as! Int
}
Don't forget to add additional checks while using this code, case where the last item is not an integer or there is an array not in the expected format. Otherwise, it will lead to a crash.

How to elegantly initialize a Scala service from a database? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I've been away from Scala for a while, so I'm trying to get back into the idioms. I have three database calls:
db.getInventory(inventoryId: UUID): Future[Option[Inventory]]
db.getInventoryFields(inventoryId: UUID): Future[Seq[InventoryField]]
db.allInputs: Future[Seq[Input]]
If db.getInventory is Some(inventory), I want to initialize my service by giving it a
CacheContext(inventory: Inventory, fields: Seq[InventoryField], inputs: Seq[Input])
but if it's None, I want to report and error and return.
What is the best combination of for/map/flatMap/fold etc to use here?
This will return a Future[Option[CacheContext]].
for {
optInv <- db.getInventory(theUuid)
invFlds <- db.getInventoryFields(theUuid)
inputs <- db.allInputs
} yield optInv.map(CacheContext(_,invFlds,inputs))
Unpacking the Future (i.e. waiting) should be done much later in the code (if ever), at which point you can .fold() over the Option and report the error.

How do I sum the "money" values in the Foreach loop in my project with Swift? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 2 years ago.
Improve this question
I created a loop with foreach. My data is coming through firebase. How do I sum the "money" values in the Foreach loop in my project with Swift? Please help!
TODOS.swift / Image
IncomeList.swift / Image
Text(String("\(self.session.items.map({ $0.money }).reduce(0, +))"))
could you try insert above code below "List {" code line in "TODOS.swift / Image"?

How to search for a duplicate in a given string using scriptlet? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
How can I search for a duplicate in a given string using a scriptlet?
ScripletInput= a,b,c,a
Here the letter 'a' is repeating. If it is repeating more than once, then it should exit, else it can go ahead.
Please see Remove occurrences of duplicate words in a string
The code below will remove duplicates in a string.
<script type="text/javascript">
str=prompt("Enter String::","");
arr=new Array();
arr=str.split(",");
unique=new Array();
for(i=0;i<arr.length;i++)
{
if((i==arr.indexOf(arr[i]))||(arr.indexOf(arr[i])==arr.lastIndexOf(arr[i])))
unique.push(arr[i]);
}
unique.join(",");
alert(unique);
</script>