Data segmentation and analysis
5 views (last 30 days)
Show older comments
Hi there ,
I require analysis stages in which I would want to analyse a file for which I have the file name and accompanying data.
I'm seeking for inspiration, and I'd like to analyse parameters utilising the file and filter types.
My question is, how do I establish filters so that I can choose which data to process further?
Requirement:
How to parse and establish parameters in columns using Filttype and Filename, and to examine Threshold and em values from *.csv files.
Thank you very much.
5 Comments
Image Analyst
on 23 Sep 2023
Edited: Image Analyst
on 23 Sep 2023
"how do I establish filters so that I can choose which data to process" is still unclear. Explain in detail how you want to filter. Like based on letters in the filename, values of some column (thresholding or masking), based on row numbers, values of Filttype or idx, or what? I have no idea what kind of filter you may want. Perhaps if you told up the output of one of your filters (like what rows you want to extract out and process)... Also, exactly what does "examine" mean to you? Take the average or something else???
Answers (1)
Shivansh
on 23 Sep 2023
Hi,
I understand you want to parse and establish parameters in columns using Filttype and Filename to examine Threshold and em values from *.csv files.
To establish filters and process specific data in MATLAB based on parameters such as Filttype and Filename, you can follow these steps:
1. Read the CSV file: Use the `readmatrix` or `readtable` function in MATLAB to read the CSV file and load its data into a matrix or table, respectively. For example:
data = readtable('filename.csv');
2. Filter data based on Filttype and Filename: Identify the columns in your data that correspond to Filttype and Filename. You can use logical indexing to filter the data based on specific values. For example, assuming Filttype is in column 3 and Filename is in column 4:
filttype = 'desired_filttype';
filename = 'desired_filename';
filteredData = data(data(:, 3) == filttype & strcmp(data(:, 4), filename), :);
This code filters the data based on a specific Filttype and Filename, creating a new matrix `filteredData` containing only the rows that match the specified values.
3. Extract parameters from columns: Identify the columns in your data that contain the parameters you want to analyze, such as Threshold and em values. You can access specific columns using indexing. For example, assuming Threshold is in column 5 and em values are in column 6:
thresholdValues = filteredData(:, 5);
emValues = filteredData(:, 6);
These lines extract the Threshold and em values from the filteredData matrix and store them in separate variables.
4. Perform further analysis: Now that you have extracted the desired parameters, you can process them further as per your analysis requirements. You can calculate statistics, plot graphs, or apply any other analysis techniques using the extracted parameter values.
Remember to replace `'desired_filttype'` and `'desired_filename'` with the specific values you want to filter by. Additionally, adjust the column indices (e.g., `3`, `4`, `5`, `6`) based on the actual column positions in your dataset. Make sure to have the CSV file in the current MATLAB working directory or provide the full file path if it's located elsewhere.
Hope it helps!
See Also
Categories
Find more on X-Ray CT 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!