transposing and converting excel file
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Walter Roberson
el 10 de Dic. de 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 comentarios
Walter Roberson
el 11 de Dic. de 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.
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!