String to variable value

4 views (last 30 days)
Nicolás González
Nicolás González on 17 Jun 2019
Hello,
I am using Matlab for a college aplicattion where I have to read and operate about 200 vectors. My problem is that I do not know any way of coding able to do this authomatically, I mean, I wouldn't like to write the whole vectors one by one.
The way of operating is the next: I have about 100 electric voltage vectors with their respective values in time, and, in the same way, another 100 current vectors. What I want to do is get them divided one by one and put the results into another vector which shows electric resistance. Obiously, this division must be point by point.
Every vector is in the workspace and I made a little programm that doesn't seem to work at all. I have named them using a suffix so that I know which vector is everyone (V1, V2, V3 ... V100 and I1, I2, I3 ... I100).
In my code I use the function "strcat" to link my "V" and "I" vector with their respective number that I take from a for loop and then operate them, but the problem comes when I try to access these variables because they are only string names. How could I get the variable values from those strings?
Thank you a lot
Nicolás González
  6 Comments
Adam Danz
Adam Danz on 17 Jun 2019
If you get stuck, you can update us where you're at here in the comment section.
Nicolás González
Nicolás González on 17 Jun 2019
Fantastic, probably I will so thanks again for your help!
Greetings!!

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!