How Can I Assign variable Name?
185 views (last 30 days)
Hi guys, I have some kinds of a data, that is in the variable called as First, and each day I have to update that data, but I should not lost the last data with respective variable name, so when I update data I have to create new variable for this updated data. well it is easy when you are making it manually, but in my case it should create automatically and the name of new variables should be the date of updated day for example today is 1/14/2015 so if i updated today variable name should be 1/14/2015. Any ideas would be a great job for me.
More Answers (2)
Shoaibur Rahman on 14 Jan 2015
x = 1:5;
eval([datestr(date,'mmmm_dd_yyyy') '= x']);
x is stored in a new variable named based on today's date. If you run the above code today, then you will get:
1 2 3 4 5
Yona on 14 Jan 2015
Edited: Yona on 14 Jan 2015
you can use eval function.but it not recommended. and you cannot use / in variable name and it cannot start with a number.
so call it d01142015 or something like this.
another way is to create a cell matrix. the first column will contain the date and the second column will contain all the data for the day.