How to reference a variable in a promt to the user, where the variable will change based on the input csv file

3 views (last 30 days)
Hi all,
I am having trouble using the promt, but embedding a variable in the prompt text that asks the user wether they want to plot this data or not,
clear all; clc
[file_list, path_n] = uigetfile('.csv', 'select all the files needing to be processed', 'Multiselect', 'on');
if iscell(file_list) == 0
file_list={file_list};
end
for i = 1:length(file_list)
filename = file_list{i};
data_in = readtable([path_n filename]);
W=width(data_in)
figure
vNames = data_in.Properties.VariableNames;
for i =2:2:(W-1)
t = i
time = data_in(:,t)
i = i+1
d = i
data = data_in(:,d)
% then i need to ask user if they want to plot data
% of the specific name of the data being pulled from the table
% or delete it
plot(data.(1),time.(1),'DisplayName',vNames{d-1})
legend
hold on
end
end
for example
"would you like to plot 'Low_PressureValueY'" y/n
and the next one would be
"would you like to plot 'Pressure_DE_InletValueY'" y/n
for even numbers of i to w
If anyone could help me out it would be much appreciated,
i am trying to pull the names from a cell, the xlsx file is attatched,
Kind regards,
Brandon

Answers (1)

Jeff Miller
Jeff Miller on 16 Jun 2021
how about:
fprintf('Would you like to plot %s ? (y/n)', vnames{d-1})

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!