1
$\begingroup$

Here what i am trying to do:

I have a list of the names of excel files, for example

s={"red carpet.csv","red box.csv","black carpet.csv","black box.csv"};

i am selecting the csv files with the name red(for example) by doing

`selectfromAll=Select[s, StringMatchQ[#, ___ ~~ "red" ~~ ___] &];`

Now i want to create a dynamic box using this command, the output in this example is two check box : "red carpet.csv" and "red box.csv"

a=CheckboxBar[Dynamic[selected], SelectfromAll, Appearance -> "Vertical"]

I want to select one or the two check box, then use the information to import this two excels files, like for example

Import[Ifchecked(a)]

Hope my description is clear

Any suggestions?

thx in advance

$\endgroup$
2
  • $\begingroup$ You'll need a Button or similar to indicate that the user interaction with the CheckboxBar[] has finished $\endgroup$ – Dr. belisarius Jan 28 '15 at 16:23
  • $\begingroup$ Any idea how to manage that? I am kind of new to the gui in mathematica! $\endgroup$ – kevin Jan 28 '15 at 16:26
1
$\begingroup$
s = FileNames["C:\\*.csv"];
selectfromAll = Select[s, StringMatchQ[#, ___ ~~ "rob" ~~ ___] &]
Pane[Column[{CheckboxBar[Dynamic[selected], selectfromAll, Appearance -> "Vertical"], 
     Dynamic[selected], 
     Button["Import", imported = Import /@ selected]}]]
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.