create string of characters from variable name matlab
Show older comments
I want to create string of characters from variable name And use it as a name of an excel file. It's easy to create a single string but I want to write a function that generalizes this situation. For my part: I have a signal that I have to cut into several windows, for each window I have to calculate values (5 values) And in the end I have to store: for each window of a signal, its parameters in a file
Example:
Signal S.
I cut signal S into 3 windows; I need to create 3 excel files:
S_1
S_2
S_3
Proposed solution :
function str = display (signal, i)
formatSpec = "% s_% d";
str = sprintf (formatSpec, signal, i)
end
function FeatureExtract (signal, numOfwindows)
for i = 1: numOfwindows
feature =parameters (signal);
str = display (signal, i)
end
end
Main program:
FeatureExtract (mysignal)
I want this result: 3 excel files for 3 windows:
Mysignal_1
Mysignal_2
Mysignal_3
2 Comments
Stephen23
on 25 Apr 2018
@Ouerdia Tahar: you did not ask us anything. What is your question?
Ouerdia Tahar
on 25 Apr 2018
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!