find substring that includes variables and generic characters, and replace with new string - problems posing search target

1 vue (au cours des 30 derniers jours)
Hello, My name is John and I am having an issue getting regexprep to recognize a series of characters. I have read a text file into a string, and want to find instances of this [var1]([index1]) = [existingvalue] and replace [existingvalue] with [newvalue], resulting in [var1]([index1]) = [newvalue]. E. g. EXNE(5) = 9.38487 with EXNE(5) = 9.3928 or XTE(17) = 9284.19 with XTE(17) = 92.934. The index goes from 1 to 25 for each variable.
This is the main part, and I want it to do what appears here:
variablenameindex = {'var1','var2','var3','var4',...}
var1valueindex = {5.203, 6.204, 7.839, 9.093,%... to 25
var2valueindex = {7.803, .204, 9.839, 1.093,%... to 25
%... to 13 variables
variablevalueindex = {var1valueindex,var2valueindex,var3valueindex,...}
for i=1:length(variablenameindex)
var = variablenameindex(i)
vector = variablevalueindex(i)
for j=1:25
val = vector(j)
regexprep(fullstring,strcat(var,'(',num2str(j),')',' = ','\d*.\d*'),... strcat(var,'(',num2str(j),')',' = ',num2str(val))
end
end
for i = 2 j = 4 for instance, I can't get it to recognize var2(7) = X.XXXX and make it var2(7) = 1.093. Any help would be much appreciated!!! Thanks, john

Réponses (0)

Catégories

En savoir plus sur Text Analytics Toolbox dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by