Changing a string variable on each iteration of a for loop for saving
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
There’s a problem I’ve been having as long as I’ve been using matlab, and I’d like to get an answer once and for all. It has to do with input that has to be in quotes, saving, and changing filenames in a non-manual manner. Let me illustrate. I mainly use MatLab in my function as neuroscientist in training. I program my experiments in it, and collect the matrices with the results of my experiment, to be saved as .mat files, and .csv files, and exported to data analysis programs. In this line of work, at some point you want to split your results to have a separate matrix for each participants responses to each condition. Right this moment, I have done 7 participants, and 8 conditions, that makes 56 separate matrices. I do NOT want to save them all by hand. So I’ve been looking for a way to use for loops to do that for me. However, to save a matrix, use the save function, or the csvwrite function, the filename needs to be supplied within quotes => ‘’. The eval function, which I use to change the name of the matrix while filtering the data, is thus not useable, since quotes within quotes don’t work. I’ve had this problem also with other functions that need string inputs. Is there ANY way, in MatLab, to “isolate quotes”? Such as put them between other signs? Some programming languages use / for that, so that /’/ makes the ‘ read within the quotes it’s already in. Or maybe some other smart way to vary string variables in a for loop in such a way that I can input them into save or csv write functions? Thanks a bunch! Sirius
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Characters and Strings in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!