f



changing a variable name in multiple files

grettings all,,

how can I change the name of a variable that exists in multiple .m files without opening each file?
0
6/13/2013 9:31:09 AM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

3 Replies
564 Views

Similar Articles

[PageSpeed] 54

On 6/13/2013 4:31 AM, Mar wrote:
> grettings all,,
>
> how can I change the name of a variable that exists in multiple .m files
> without opening each file?

Can't.  Now, you could use a programming editor that has facility to 
look at more files or write a utility (not trivial for general case) but 
still even those will have to open the files.  But, I presume the 
question is from the Matlab editor and afaict it doesn't have the 
facility to make changes across files even if their already open.

--

0
none1568 (7453)
6/13/2013 12:23:43 PM
dpb <none@non.net> wrote in message <kpcdkc$8o8$1@speranza.aioe.org>...
> On 6/13/2013 4:31 AM, Mar wrote:
> > grettings all,,
> >
> > how can I change the name of a variable that exists in multiple .m files
> > without opening each file?
> 
> Can't.  Now, you could use a programming editor that has facility to 
> look at more files or write a utility (not trivial for general case) but 
> still even those will have to open the files.  But, I presume the 
> question is from the Matlab editor and afaict it doesn't have the 
> facility to make changes across files even if their already open.
> 
> --

Thank you for the help..

How do you think I can tell Matlab developers that a feature like this maybe useful in the coming releases??
0
6/14/2013 4:33:18 AM

"Mar " <eng.marwan.h.hussein@gmail.com> wrote in message 
news:kpe6ee$ft6$1@newscl01ah.mathworks.com...
> dpb <none@non.net> wrote in message <kpcdkc$8o8$1@speranza.aioe.org>...
>> On 6/13/2013 4:31 AM, Mar wrote:
>> > grettings all,,
>> >
>> > how can I change the name of a variable that exists in multiple .m 
>> > files
>> > without opening each file?
>>
>> Can't.  Now, you could use a programming editor that has facility to look 
>> at more files or write a utility (not trivial for general case) but still 
>> even those will have to open the files.  But, I presume the question is 
>> from the Matlab editor and afaict it doesn't have the facility to make 
>> changes across files even if their already open.
>>
>> --
>
> Thank you for the help..
>
> How do you think I can tell Matlab developers that a feature like this 
> maybe useful in the coming releases??

Contact Technical Support using the instructions below and let them know how 
you'd make use of this feature so they can enter it in the enhancement 
database.

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
slord (13689)
6/14/2013 1:33:14 PM
Reply:

Similar Artilces:

Extracting variables from multiple *.txt files and having the variable name dependent on the name of the *.txt file
I have about 30 *.txt files that have contain data in the same format. I'd like to extract a certain set of data from each of these files, and store them as their own variables, not in a matrix. Each file name is structured in the following way: name_20xx_yy.txt where xx reflects the 2-digit year and yy reflects the 2-digit month of each data set. I'd like to be able to create column vectors from the data set that reflect the different data sets that they come from, i.e. var_20xx_yy= name_20xx_yy(:,3) This way I will have 30 different var_xx_yy variables each reflect...

Change names of variables and functions in multiple files?
Hello I would like to have a program that allows me to change a word in multiple files. I need to change multiple variable and function names (to comply with a coding standard). Any tips? Found help here: http://www.makeuseof.com/tag/how-to-find-and-replace-words-in-multiple-files/ :-) Geek escreveu: > Hello > > I would like to have a program that allows me to change a word in > multiple files. > > I need to change multiple variable and function names (to comply with a > coding standard). > > Any tips? > As you seem to be posting from a Microsoft ...

How to write multiple files (.dat or .txt) with consecutive file names in matlab
I have the following scenario: for t = 1:10 % As time goes from 1 to 10. for i = 1:10 % As position goes from 1 to 10. u(i) = some operation end s = u'; % Just getting a transpose so i can read the data better. save ("File(i).txt', 's', '-ascii', '-tabs'); % I know this doesn't work. I need a help with this. end Desired output: File1 : with dat...

changing name of global variable file
I want to change a global variable file. Because I stupidly named it global.vi. My application is quite big... I don't want to replace all the global variable in my application. How can I do that? Also, what if I want to change a global variable's name. Is there a way to change name without browsing through all my app...? Thanks Nitrof ...

Lossy File Change name with MATLAB
I want to switch a .tiff extension to .tif (it is the only type of file this program will take). I have this code; however I loose a lot of information. Everytime I read through. I believe it has to do something with what i'm doing. Basically it is automatically reading a file and writing it... but here is the brief version a=double(imread('image.tiff')); imwrite(a,'test.tif'); it works when i do that but in the program it fails to work correctly! Something funny in the code peoples :( clear all; close all; idx = 0; % Counter (Index) numDigit = 3; inFileName = 'Im...

Can I change multiple file names together?
Here's my situation. I'm using Windows XP. I have several hundred file names that I want to change. I want to keep the existing file names, but add a prefix to them. I know I can do each one separately. Is there a way I can add the same prefix to multiple filenames? There is a free utility to do this. See: http://www.download3k.com/System-Utilities/File-Disk-Management/Download-All-File-Renamer.html or http://www.download3k.com/System-Utilities/File-Disk-Management/Download-Sequential-File-Rename.html On 26 Feb 2006 06:23:32 -0800, "David" <revenert@hotmail.com> w...

Creating a variable to change the name of an export file
I have a database that I periodically export to a text file for a Word mail merge. I have a query that finds all of the records with a null export date and a query that updates the export date to now(). I have a macro that runs the first query, uses TransferText to send it to a file, then runs the update query. However, the file name in TransferText is "hard wired" so whatever was there before gets written over. Is there a way to create within the macro an environmental variable for the file name based on date/time so that I can keep these export files? I would use VBA code...

reading variable name from file and then creating in matlab
Hi. I am working on a code right now that should read data from an excel file (which it does), then using the two data arrays txt and values do some calculations. My issue is that I need the variable names in matlab to match the variable names in the file. So i have been doing: <code> num = length(txt) for (i = 1:num) name = cell2mat(txt(i)) evalin('base',sprintf('%s',name)); end <end code> or something similar. you get the idea. Basically the variable name that is at txt(i) will be used as a variable later in the code. and i keep getting the sam...

Reading Multiple .sav files with same variable names for graphing
Hello, I have 9 .sav files each containing a different days data but with the same= set of variable names. I am trying to figure out a better method to read e= ach of these files and save the variables to different named arrays or stru= ctures so that I can then plot several days of data in the same graph. The = method i've been using right now involves a lot of coding (shown below for = first 2 files). Is there a better way to do this so that I can then plot mu= ltiple arrays from different .save files on the same graph? Thank you. Sincerely, Morgan restore, './DAQP...

Reading in Multiple CSV files with changing number of variables
I have been working on this for a few hours and have been unable to find a solution. Any help would be much appreciated. I am reading in a large folder with 1000s of .CSV files using a wildcard in the INFILE statement. My problem is that each CSV files may contain different variables and the name of the variables it contains is in the first line. For example, the first CSV file has three variables (x, y, and z) with numeric observations: x,y,z 1,3,2 4,2,3 1,9,7 But the second CSV file has only two of the variables (x and z): x,z 5,4 6,1 What I want is for SAS program to recognize that ...

Can ODS output multiple files named as the BY variable?
Hi, Test code: data test; length userid $3 num 8; input userid num; datalines; ABC 1 DEF 2 GHI 3 ; run; options nobyline; proc report nowd; by userid; columns userid num; define userid / width=10 display; define num / display; run; My desired output are files named ABC.{PDF|RTF|HTML|XLS|???}, DEF, GHI, etc. IOW I want a filename matching the value of the BY variable. Can this be done, perhaps by using PROC TEMPLATE? I could write everything to one big temp file, then post process it, checking for page break characters, etc. But that seems so 20th ...

matlab variable name with space in name
Hi, I've loaded some exported measurement into matlab. Unfortunately some of the variable name contains a white space. I can see them in the workspace browser but can not further proceed with them. Is there a way to rename or copy these variable to a new one using a script or matlab function or anything else (means not performing this by hand inside the workspace browser). Thanks, Olaf On 7 Aug, 15:22, Olaf <norep...@inder.net> wrote: > Hi, > > I've loaded some exported measurement into matlab. Unfortunately some of > the variable name contains a white space. I ca...

Variable in name of file for named.conf
I have a number of slave domains that I would like a naming scheme and not have to go to each and change the filename. I have the following zones zone "1.168.192.in-addr.arpa" { include "named.slave"; }; zone "2.168.192.in-addr.arpa" { include "named.slave"; }; zone "3.168.192.in-addr.arpa" { include "named.slave"; }; zone "4.168.192.in-addr.arpa" { include "named.slave"; }; zone "5.168.192.in-addr.arpa" { include "named.slave"; }; zo...

excel file name as variable name?
Hi, I'm very new to MATLAB. I have several Excel files whose names contain dates (mm.dd.yy). Each file contains 28 columns of data which need to be assigned to 28 unique variables. My problem is... I would like to use the digits in each Excel file name as part of the names of each variable. For example, if one Excel filename is "9.6.06 RW.xls" I would like to create variables (1440x1) named: L19606 L29606 .. .. .. L289606 I have written a routine that gives me just the digits (9606, in this case), but I'm having trouble figuring out how to automate the creation of v...

wantr matlab to open a file using contents of a variable name as the filename
Need to input data from file. however do not want to use the actual filename however would like to use a variable containing the filename such as; dlmread(a) where a is a string variable which contains the name of the file such as 'matlab.txt'. is there any other way I can load contents of a file using variable as filename. want matlab to look at content of variable and automatically extract the filename from it and open the file. "Gianni valente" <gvalente@qualcomm.com> wrote in message <i797ki$fgn$1@fred.mathworks.com>... > Need to input data fro...

Change the name with the random names in a text file
Hi Guys, I am fairly new to the language and programing. I am trying to solve a problem in a text file. Where names are something like in this manner [**Name2 (NI) 98**] [**Last Name (STitle) 97**] [**First Name4 (NamePattern1) 93**] [**Last Name (NamePattern1) 94**] ([**Name (NI) 95**]) [**Last Name (un) 96**] I am trying to change these with random names. Any ideas or how should I do it. Any help appreciated. Thank in advance On Tue, Jun 28, 2011 at 12:17 PM, Amaninder Singh <asingh0412@gmail.com> wr= ote: > Hi Guys, > I am fairly new to the language and programing. I am try...

how to change the name of variables in dataset2 to the variables in dataset1?
Hi, If dataset1 and 2 have the same number of variables just different names. How to change the the names of variables in dataset2 to the names of variables in dataset1? Hi, I may want to check this SUGI28 paper: http://www2.sas.com/proceedings/sugi28/118-28.pdf On Mar 24, 10:18 pm, Bestwishes <irain...@gmail.com> wrote: > Hi, > > If dataset1 and 2 have the same number of variables just different > names. How to change the the names of variables in dataset2 to the > names of variables in dataset1? Hi, You may want to check this SUGI28 paper: http://www2.sas.co...

Re: Variable in name of file for named.conf
> It would be a nice feature, but in lieu of that, you could always > have a script manage your named.conf and incorporate the > variable-substitution logic into that. If you want to go Old School, > use cpp, make, sccs, some of those long-forgotten tools :-) I've had wonderful success with Makefile(s) and macro 4. - Talk about old school. -- Grant. . . . unix || die ...

saving files using a variable file name
I would like to have a loop that saves a series of files of different names but it seems like I can't use a variable string as my file name when using save. For example: >> name = 'testname.mat' >> save name saves a file named <name.mat> when I'd like a file named <testname.mat>. Is there a way to do what I am looking for? Thanks. Kasey Kasey Horton wrote: > > > I would like to have a loop that saves a series of files of > different > names but it seems like I can't use a variable string as my file > name > when using save. ...

Change file properties across multiple files
I can't find a tool that will allow me to change a custom property (in a drawing file for example) across multiple files. Not ADD a custom property, but change it. I've found several that can add properties. A typical drawing package for me could be upwards of 30 individual drawing files. If those all change status (from 'To Be Approved' to 'Production' for example), I believe that I have to change that property one by one in each file--not very productive. Does such a tool exist? Thank you in advance, Brian On Wed, 1 Sep 2004 18:41:59 -0400, Brian Mears <m...

adding a variable name to a hash to name is part of the variable name
I have a perl script that I wrote the loops through a list of servers in a file and I want to create a hash with the server name in it. I want each server to have its own hash. for example $myserver = thor; hash name $server_$myserver_name{$some_key} want to get this hash name $server_thor_name{$some_key} How do I get the $myserver name to be interpolated to thor in that line? I tried this and it failed. $server_${myserver}_name{$some_key} -Bobby Bobby Chamness wrote: > I have a perl script that I wrote the loops through a list of servers > in a file and I want to create a hash...

i made a gui in matlab now i want to get a variable's value(that is a 3 by 3 matrix) defined in a script file(named nn2)
i made a gui in matlab now i want to get a variable's value(that is a 3 by 3 matrix) defined in a script file(named nn2) manish sahu <manish.comp05@gmail.com> wrote in message <ad202390-c536-473e-8496- 664d9b45e403@b5g2000pri.googlegroups.com>... > i made a gui in matlab now i want to get a variable's value(that is a > 3 by 3 matrix) defined in a script file(named nn2) well, run the script so the variable is in the workspace, then use it. ...

Rename multiple files using names in a text file
Hi, I would like to rename files (jpg's ones) using a text file containing the new names... Below is the code that doesn't work : ***** #!/usr/bin/python #-*- coding: utf-8 -*- from os import listdir, getcwd, rename import re list_names=['new_name1','new_name2'] list_files = listdir(getcwd()) filtre = re.compile("jpg$", re.IGNORECASE) list_jpg = filter(filtre.search, list_files) #strip all element of list list_jpg list_jpg_strip=[] for nom in list_jpg: #print nom.strip() list_jpg_strip.append(nom.strip()) #let's rename : i=0 while i <= len(list_jpg_...

i made a gui in matlab now i want to get a variable's value(that is a 3 by 3 matrix) defined in a script file(named nn2) #2
i made a gui in matlab now i want to get a variable's value(that is a 3 by 3 matrix) defined in a script file(named nn2) manish sahu <manish.comp05@gmail.com> wrote in message <66e1285d-5710-4f8b-90fc-b4a8d732dd30@h1g2000prh.googlegroups.com>... > i made a gui in matlab now i want to get a variable's value(that is a > 3 by 3 matrix) defined in a script file(named nn2) U can use fread command to red and then converting string to numerical value, else u can save the data into a mat file and read back. Is it what u are looking for?? Ashwini ...

Web resources about - changing a variable name in multiple files - comp.soft-sys.matlab

The Changing Light at Sandover - Wikipedia, the free encyclopedia
"The Changing Light at Sandover" is a 560-page epic poem by James Merrill (1926–1995). Sometimes described as a postmodern apocalyptic epic, ...

Is Facebook Changing How We Travel?
When one of your Facebook friends posts a photo album of their trip to Maui, they’re not just showing off — they might also be acting as a travel ...

Missed this week's Changing Track?... - 774 ABC Melbourne - Facebook
Missed this week's Changing Track? We've got you covered. Like to submit your own? Email it to 774drive@abc.net.au

Facebook changing PMD program to Facebook Marketing Partners
Facebook’s Preferred Marketing Developer program may be getting a new look. Earlier today, Facebook announced on the Facebook for Business page ...

Changing Lanes (@chginglanes) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Changing the way business decisions are made
We believe that social data has unlimited value, and near limitless application. Today, we’re taking an important step toward unleashing this ...

12 Minutes To Create a Mind-Changing Presentation
... draft great presentations and to become a more effective and convincing presenter. Twelve minutes which can 12 Minutes To Create a Mind-Changing ...

We're Changing Our Name (Back) to Stack Overflow
We are Stack Overflow. You may know us from such popular websites as Stack Overflow Q&A, Stack Overflow Careers, The Stack Exchange Q&A Network, ...

The Tao of Twitter: Changing your life and business 140 characters at a time - Amazon
It's time to take the mystery out of Twitter. Twitter may be the most powerful business and personal networking platform ever created but it ...

App Store - Voices 2 ~ fun voice changing!
Read reviews, get customer ratings, see screenshots, and learn more about Voices 2 ~ fun voice changing! on the App Store. Download Voices 2 ...

Resources last updated: 3/10/2016 12:15:49 PM