Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Calling the Correct Global Variable

$
0
0
Thanks for the feedback, I'll try going about it a different way.

"Jason" wrote in message <kvmnrh$qgk$1@newscl01ah.mathworks.com>...
> I am trying to call the correct values from a global variable using user inputs. First off here is my code:
>
> clear all
> clc
> wsectionz;
>
> prompt = 'What is the Nominal Depth (in) Parallel to the Flange? ';
> Nom_D = input(prompt);
>
> prompt = 'What is the Weight in Pounds Per Foot of Length? ';
> W_sec = input(prompt);
>
> a = {'W'};
> b = {'x'};
>
> c = strcat(a,int2str(Nom_D),b,int2str(W_sec))
>
> d =get_section_property(W,***Help Here***);
>
>
>
> ***Help Here*** is where I am having trouble. All the ways I have tried to call the correct information come back as errors. The output for "c" is the information I am trying to use from global variable W.
>
> "get_section_property" is the function that requires the correct input.
>
> "wsectionz" contains the different values for my global variable, W. I defined W as follows:
>
> global W
> W= {'W36x300',[36.74,16.66,0.95,1.68,88.3,20300,1300,64.2,300,1244,244];
> 'W36x280',[36.52,16.6,0.89,1.57,82.4,18900,1200,52.6,280,1157,226];
> 'W36x260',[36.26,16.55,0.84,1.44,76.5,17300,1090,41.5,260,1064,207];
> 'W36x245',[36.08,16.51,0.8,1.35,72.1,16100,1010,34.6,245,997,193];
> 'W36x230',[35.9,16.47,0.76,1.26,67.6,15000,940,28.6,230,931,179];
>
> My code can combine user inputs to create a string with the correct global variable title, but I can't figure out how to use this to call the correct information. For example, I can get "W36x280" as an output, but I need help to get the function "get_section_property" to pull this information from global W.
>
> Thank you for any help/advice

Viewing all articles
Browse latest Browse all 19628

Trending Articles