How do I Create a Matrix that connected to Excel using MATLAB

1 visualización (últimos 30 días)
Mohammad Danial Bin Kamarul Zaman
Mohammad Danial Bin Kamarul Zaman el 15 de Feb. de 2019
Editada: dpb el 16 de Feb. de 2019
How do I create a loop matrix that starts from 1X1 (value 15 as shown in the picture) to the final row lets say nX1. At the same time, it saves all the nodes corresponds to the element as shown in the figure.

Respuestas (1)

dpb
dpb el 15 de Feb. de 2019
Editada: dpb el 16 de Feb. de 2019
Have to know the structure of the file or write code to find what you want...I'll presume you can count columns... :)
>> [n,t,r]=xlsread('Original2.xlsx','original'); % read the worksheet
>> r(1:5,:) % look at beginning of file to find data of interest
ans =
5×19 cell array
Columns 1 through 13
{[ NaN]} {[ NaN]} {[ NaN]} {[NaN]} {[NaN]} {[NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]}
{'Element Number'} {'Equivalent (von…'} {'nodes'} {[NaN]} {[NaN]} {[NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {'Node Number'}
{[ 15]} {[ 474460]} {[ 115]} {[335]} {[311]} {[116]} {[1003]} {[1968]} {[1001]} {[1000]} {[1008]} {[1007]} {[ 1]}
{[ 26]} {[ 441010]} {[ 114]} {[336]} {[316]} {[115]} {[ 998]} {[2000]} {[ 997]} {[ 996]} {[1004]} {[1002]} {[ 2]}
{[ 30]} {[ 371840]} {[ 3]} {[108]} {[358]} {[314]} {[ 415]} {[ 970]} {[ 419]} {[ 417]} {[ 969]} {[1986]} {[ 3]}
Columns 14 through 19
{[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]} {[ NaN]}
{'X Location (m)'} {'Y Location (m)'} {'Z Location (m)'} {'Equivalent (von…'} {'Element Number'} {'Equivalent (von…'}
{[ 0.0064]} {[ 0.0081]} {[ 0]} {[ 160450]} {[ 1]} {[ 374200]}
{[ 0.0064]} {[ 0.0031]} {[ 0]} {[ 72334]} {[ 2]} {[ 465190]}
{[ 0.0064]} {[ 0.0081]} {[ 0.0160]} {[ 167460]} {[ 3]} {[ 935070]}
>> n(1:5,1) % converts to numeric beginning where want...
ans =
15
26
30
32
33
>> nodes=n(:,(3:12)); % select columns of interest
>> nodes(1:10,:) % see what we got for a few of 'em...
ans =
115 335 311 116 1003 1968 1001 1000 1008 1007
114 336 316 115 998 2000 997 996 1004 1002
3 108 358 314 415 970 419 417 969 1986
115 316 311 347 1002 1966 1001 1005 2002 1970
309 311 316 347 1948 1966 1949 1953 1970 2002
113 337 316 114 995 2001 993 992 999 997
308 313 328 348 1938 1980 1942 1943 1981 2047
113 324 316 337 994 1999 993 995 2032 2001
309 318 311 347 1951 1967 1948 1953 2010 1970
118 334 312 315 1018 1974 1016 1017 1994 1971
>>

Categorías

Más información sobre Stress and Strain 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!

Translated by