transposing and converting excel file
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello; I am a new user. I would like to automate a process that will save me a lot of time. In attached excel file I have some calculations of stresses for different parts. I want to take the data of "Part ID" and "Mean Stresses" and of a string format, which is on right side of excel file, that is compatible with the software I use. The red color and blue color represent the location of the data in string. The rest of the data should not be changed (Each sheet has different data). Finally, all the output should be dumped into a txt file. Is that a possible work to do so? Any kind of help is appreciated. Thank you. Muhsin
0 commentaires
Réponses (1)
Walter Roberson
le 10 Déc 2017
fid = fopen('final output.txt', 'rt');
data = cell2mat( textscan(fid,'%f%f%f%f%f%f%f%f', 'delimiter',',','comment','*') );
fclose(fid);
data3d = permute(reshape(data,7,[],8),[1 3 2]);
Now data3d is a numeric array, 7 by 8 by the number of "*MAT_USER_DEFINED_MATERIAL_MODELS" blocks. Because your input lines are not all the same size, the shorter rows are padded with NaN.
Nothing in the input file you attached is an obvious part id or mean stress, or red or blue. Also, I do not see what you are asking to do with the data. But at least the above code will read the data into a consistent format suitable for mechanical processing.
3 commentaires
Walter Roberson
le 11 Déc 2017
That csv appears to have two Part ID and two mean stress entries on each of the main lines.
I do not understand how the input is to map into the output file.
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!