Reading series of output .h5 snapshots on IDL - simulation

Using IDL, I need to append a certain value from each .h5 OUTPUT(snapshot) series into an array.
The series are like as follows zya_0000_T.h5, zya_0001_T.h5, ...., zya_0100_T.h5 (say).
Thanks in advance!

Related

Creating Feature vector in .mat file for training dataset

I wanted to create a feature vector for training dataset and wanted to store all feature as rows in the.mat file. The .mat file must be in the form Feature Vector. I am able to extract Feature of 1 image and store it in excel file or .mat file but not able to extract all image feature and store it in .mat file. Can anyone knows this?
Its something like appending the same variables in the same .mat file. I have tried
save('feat.mat','feature','-append');
Where 'feature' is an array
feature = [mydata, stats{k}];
I have a folder which contains images who's feature I wanted to extract and store as training dataset. Any help will be appreciated.
the code was rectified.
stats = graycoprops(GLCM_values{'contrast','homogeneity','Correlation','Energy'});
stats was a structure so converted into the array using
features=struct2array(stats);
and was able to save the features

Writing labels & data to a CSV file for face recognition. MATLAB

I have done PCA for 21 images of the same person in different conditions. LAst step of the PCA is projection of original data : signals=PC'*data. Size of signals is 21*21, now I want to write this to a CSV file with a label as +1. Please guide me how to do this in matlab. I tried csvwrite but it does not write the labels, only the data.
[signals,V]=pca(im2double(inputdata));
for i=1:length(signals)
for j=1:1
label(i,j)=+1;
end(both for)
csvwrite('f1.csv',[label signals]);

dlmwrite for specific rows and columns in matlab

I have 2D data for 10x10 matrices, and it looks like this
here is the table
However, data is updating and append every dt calculation, therefore I would like to reorganize and write it for specific columns , you may see this table in link
I use normally those codes to write
t=t+dt;
if ss==2000
dlmwrite('d:\Model_Results_Theta.txt', Tnew,'-append');
ss=0;
end
Could you recommend me any different way to organize the data based on the specific rows and columns using the matlab codes? Thanks in advance !!

Matlab how to open file in excel put into array and convert numbers to units of measurement

I have an excel file to open matlab and put into an array of cells - then take the numbers in the cells and convert a few measurements. how do i do this
I'd suggest looking into the two functions xlsread and xlswrite These both handle input (from an .xls or .xlsx) file to matlab and output from matlab to an excel file, respectively. If you're looking to do something different than that, please elaborate a bit more than what you've posted.

How to I give input through a file in MATLAB?

I have a data file having 50 2-D data points written in Notepad. I want to use it in clustering algorithm to cluster these 50 points. How can I import this file? Is there any other way to use it in program?
You can save the data as a .csv file or you can save it to an excel spreadsheet and use xlsread(). See here for more info: http://www.mathworks.com/help/techdoc/ref/xlsread.html
For the .csv case, this post should prove helpful: Fastest way to import CSV files in MATLAB
Imagine you had the following data:
X = [randn(100,2)-1 ; randn(100,2)];
save data.mat X
Then its as simple as doing:
%# load data from MAT-file
load data.mat
%# cluster into K=2 clusters
C = kmeans(X,2);
%# show cluster assignment
gscatter(X(:,1), X(:,2), C)
It depends how you have formatted the data file. You say it is saved on notepad but that is not too helpful. Depending on what you have used as the data delimiter you can import the datafile into an array using the dlmread function. For example if your file is called filename.dat and have used a ; character to separate each data item within this file you could read the data into a matrix A using
A = dlmread("filename.dat",';');
I would suggest reading the help documentation on the dlmread function in matlab.