Array Definition and 481 Threads

  1. A

    Not sure how to start a Pseudo for an Array

    I am VERY new to this, i am trying to start a pseudo code write where i need to make an array. I have my flowchart done (at least i think i do ) but i am not sure how to actually start the code. The examples my teacher had are confusing and he is not answering my emails. I have to write pseudo...
  2. S

    Insert new element to array and how shift char type

    Homework Statement struct student { char name[20]; int id; float gpa; }; student a[20]; Homework Equations insert another element into the array a. The Attempt at a Solution #include<iostream> using namespace std; #include <stdio.h> #include <string.h>...
  3. L

    Array of underwater transducers for sound massage

    hello, since a while my mind is caught by an idea. This idea is concerned with underwater sound massage system. For this purpose i would like to build an array of underwater sound transducers, which can all be steered individually (to do a coarse beam forming). However, since i am...
  4. A

    Comp Sci Understanding Java Recursive Array Reversal

    supposed to reverse an array of strings recursively. this is in a class that has an array object. i came up with what's below. but it reverses the array in a weird order. the array is a 5 element array, the elements are {hello, how, are you, ?}. i passed in the object and after printed out...
  5. U

    C/C++ C/C++ question, const versus #define for defining array.

    I know that it's often considered better practice to use C's "typed constants" instead of "#define" as it may offer better error/type checking. I'm wondering however what happens if a const is used to declare the size of an array. For example consider the two possible methods below. #define...
  6. S

    Struct array memory layout of the elements

    hi every one , i am new in data structure course i need help in this : Struct Person { Char name[20]; int id; float gpa; }; Person student[5]; Compute the addresses of all the elements of array student and show a memory layout for the array if the address of the first...
  7. 1

    Fortran Fortran 77 making an array but changing the increment value

    Hi I have an array going from 0 to n (where n has been previously defined) but I want the array to be in steps of 5 rather than increasing each value by 1 eg 0,5,10,15,20,25...n how can I do this? Thanks
  8. J

    Replacing specific array elements in IDL

    Replacing specific array elements in IDL - solved! Hi I was just wondering if there was any way, other than using FOR loops, to replace specified elements of an array? For example, say A is a 1D array of 50 elements, each equal to 1.0. Is it possible to change say elements 0-9 and 30-49...
  9. M

    What is the difference between the two selection sort algorithms?

    I'm trying to understand a sorting algorithm (selection sort, to be exact). I started out with this: public static void selectionSort1(int[] x) { for (int i=0; i<x.length-1; i++) { for (int j=1; j<x.length; j++) { if (x[i] > x[j]) { //... Exchange...
  10. J

    Solve Function & Array Exercise for Students

    Dear please read this exercise and the codes and tells me what wrong with you codes Part 1 You are provided with a skeleton program, where the data is stored in arrays. Your task is to add the code that will do the following: Examine the data in the arrays. The data shows the results from...
  11. Y

    E and H pattern of 2 element antenna array.

    This is not a homework, too old for that! I just have a question that I create myself. All the books only show the pattern that is more obvious...they show either the E or the H pattern. I took an exercise that asked for the H pattern, in turn, using the pattern multiplication to try to find the...
  12. S

    Building a Plot with Array Data: A Challenge

    Hello. I've got an idea to build a plot in real time. What i want to do: 1) I've got a row (array) of numbers 2) for these numbers i calculate values of the expression i want to plot, put them into array, 3) use list plot or smth like that with the row and the array. The question is : how...
  13. R

    What's the purpose of an array?

    I know what an array is and what it does. I'm just having a hard time getting the concpet on how it is useful.
  14. Z

    Fortran Increasing Size of FORTRAN Array without Reallocation

    Is it possible to increase the size of an already allocated array in FORTRAN, without reallocation? e.g. if in start A(3)=[4, 5, 6] and now I want something like A(4)=[4, 5, 6, 7]. Currently I am using a temporary array to do this allocate(A(3)) A=(/4, 5, 6/) allocate(temp(3)) temp=A...
  15. M

    Comp Sci What does the error T does not match T mean in my Java code?

    I am getting compilation errors in the following segment of my code: _underlyingStorage was declared in the following way: private T[] _underlyingStorage = (T[]) new Object[128]; public T next() { _currentIndex++; if(_underlyingStorage[_currentIndex] ==...
  16. 1

    Fortran Fortran 77 help making an empty array (or blank list if they exist in fortran)

    I need to create an empty array but the length of the array is determined by the start and end numbers entered by the user for example if the range of numbers the user was interested in was 4-10 inclusive then i want the array to be of length 7 How to I go about doing this? Other...
  17. U

    Is it possible to build a mirror array with adjustable focal length?

    Is it possible to build a large mirror array (around 10 km²) with adjustable focal length (from 10 meters to around 400 kilometers)?
  18. D

    Optimal Tilt Angle of Solar Array

    Hello! I have a difficult problem I have been working with recently. I have been trying to model the ever changing position of a solar PV array system. The system is a single axis tracker and orientates itself to have the smallest angle of incidence(AOI) to the suns beam as possible (the best...
  19. A

    Fast Maximum Value Computation in CUDA C Arrays

    I was wondering if anyone knows a fast method of finding the maximum value in a Cuda C array. I can't get max_element to work, but not sure its very fast anyways. I know I could do a for loop, but for an array with 100,000+ elements (smallest cases) it takes a lot of time (plus it has to...
  20. L

    Split Numerical Array of 100 Integer Values 0-99

    Homework Statement Define an array with 100 integer values, and fill the array with random numbers in the range from 0-99. Then write a function named split () that reads the array and places numbers from 0-50 and another array that places numbers from 50 to 99. I wrote this code which...
  21. T

    MATLAB Counting Occurrences in a 2D Array with MATLAB

    Hey peeps, I was bored the other day and wanted to paint something, so I started tweaking images in mathematica to make them eaiser to paint/draw and I came across de jong attractors and the following http://flam3.com/flame.pdf" . Basically I immediately remembered I had forgotten most of...
  22. B

    MATLAB MATLAB newbie: how to index a string array?

    I'm a Matlab newbie. I have an array of strings, for example: header = {'Fred', 'Tom'} When I do: header(1) I get 'Fred' I want to be able to change elements--for example: header(1) = 'Jill' But I get this error: ? Conversion to cell from char is not possible. I would be...
  23. W

    How can I override my instance variable of array type

    Hi All, Sorry to bother anyone, but I have run into a inheritance problem. I have a base class which contains a member variable of array type, and an abstract method. Subsequently I created a sub class which derived from the base class. And I provide implementation for the abstract methods...
  24. D

    Calculating Solar Array Orientation for Scientists

    Hello! I was hoping someone on this board might be able to point me in the right direction to solve my problem. I am trying to determine how the tilt angle (from the horizontal) and azimuth of a solar array changes as the array rotates around a fixed axis running from north to south. The...
  25. M

    Fortran How can I store values for every iteration in FORTRAN 90 using arrays?

    Well the issue here is that I will have 21 numerical values written into one array,but then goes iterative procedure and get 21 values for model 2.How to write l(m0),l(m1)?I will need these arrays later for calculations.
  26. G

    MATLAB Problem storing array value in MATLAB

    I have the following function function [W] = calcw(k1,k2,d,x) if x<d W = k1*x; elseif x>=d W = k1*x+2*k2*(x-d); end; save('varw.mat'); with the following script k1 = 10e4; k2 = 1.5e4; d = 0.1; x = 0:0.01:0.3; weight = calcw(k1,k2,d,x); plot(weight,x); but...
  27. T

    Why is the array not reading from the txt file

    help me with this vector program i want to create a program that will have an arraycalled array1[] of 30 sets of 3 one digit numbers i.e 804, 450,430 etc) i will have 13 vector containersor arrays defined with a series of 3 one digit numbers. i want the program to find any series of numbers...
  28. R

    Mathematica Mathematica Circular Shift of Array Elements

    Hi All, does anyone know of a mathematica function that efficiently circularly shifts all array elements? e.g. {1,2,3,4,5} -> {4,5,1,2,3} without iterating? The reason I ask is because I have a huge data set I'm working with and right now iterating through is very processing intensive...
  29. R

    Finding word in a two dimensional array

    Hi, I have a question about C.In a two dimensional array ,I will search a word (not a letter).Do i have to use pointers?
  30. U

    Spatial Wavelength of a Halbach array (Magnetism)

    Hello everybody Basically as the topic states: How can you calculate "The spatial wavelength of a Halbach array" (symbol lambda)? Context: The reason I ask is that since I've got bored during my easter holidays I decided to try a wee science project and try and make a model of an...
  31. C

    MATLAB How to load a non-rectangular array into MATLAB?

    We have a sensor in the lab that measures two quantities and uses two different sampling rates. All four of these vectors are saved into the same text file. How can I load this into MATLAB when it is non-rectangular? Thanks for your help.
  32. H

    Comp Sci Troubleshooting Array Lists in Java

    Homework Statement Input a list of n integer values into a 1-D array and do the following: • determine and output the number of positive values and the number of negative values • update the array values as follow • if the value is located at an even-numbered subscript, replace the value by...
  33. D

    How Can I Power a 1x1 Foot LED Array with AC Current Efficiently?

    Greetings, I am rather clueless about this stuff so I'll leave it to you guys to come up with any bright ideas for this. I'm building an array of LED's for my high school that flash to music. I'm using a TIP31C transistor to get this effect. My problem is they're wanting a 1 foot by 1 foot...
  34. N

    Mathematica Creating Simple Arrays in Mathematica for Beginners

    Hello, I have a list {a,b,c,d} and i want a array of the form: {{a,b},{b,c},{c,d}} I think it is easy, but I'm new in mathematica and I don't know what funtion to use. Thanks.
  35. A

    Mathematica Mathematica: array of functions

    Hi intelligent people, Forgive me for a silly question, but I am really new to Mathematica and thus I need your help for my own research (I am done constructing NIntegrate values for some "non-integrable" functions, involving multiple steps, and I am kinda stuck at the last step. Here is the...
  36. A

    Fortran Fortran, subroutine with allocatable, intent(out) array

    Hi, I have a rather large program written in fortran 77/90. In one of the subroutines a lot of local dynamic arrays are declared. In order to make this program able to calculate more stuff, I need to bring these dynamic arrays back into the main program. I have tried to define the...
  37. S

    Fortran Fortran: Pointer to array section with vector subscripts

    Hi. I'm trying to make a pointer point to sections of a rank-2 array given by specific values of it's second index. I other words: given a table I wan't a pointer to point to specific columns, making of it a "filtered" table. The method I was trying was like DOUBLE PRECISION...
  38. G

    The Answer: Solutions to Array of Capacitors Homework

    Homework Statement An infinite array of identical 1-microFarad capacitors are arranged in a grid setup, where junctions are between capacitors, and each junction is connected to 4 other junctions separated by another capacitor. The array is initially uncharged. A battery is connected...
  39. C

    Can't put .txt file into an array

    I'm trying to input a .txt file with a variable number of rows and 3 columns into an array. The first row is just a single number expressing the remaining number of rows. so we have something like this 3 3 5.12 3 5.3 3 5 4 3 4 All the individual numbers are separated by spaces. So far...
  40. M

    MATLAB Improving MATLAB Array Efficiency

    Hi all, I have the following code: M = zeros(N) for i = 1:N for j = 1:N M(i,j)= log(norm(rs(:,i)-rc(:,j)))+log(norm(ri(:,i)-rc(:,j))); end end Where rs, rc and ri are 2xN arrays. Is there a way to construct the matrix without the use of the two for loops? I'm...
  41. J

    IDL Q: How do I check for an NaN in an array, in a loop?

    So, I'm doing a loop through 612 rows of data, each row having 2592 numbers. If the number I'm looking at is NOT equal to NaN, I want to do a calculation using a different array. This way, if the element in sfc_data is not a number, the number in lat_matrix in that same column is ignored, and...
  42. DaveC426913

    Finding Combinations of Numbers in an Array

    Grr! This is flummoxing me! I want to add every combination of cells in n rows that will be input be textfields. The number of rows is flexible. It is defined when the appropriate number of textfields have strings of numbers in them. Each row will have its own number of cells in it...
  43. J

    C programming Q: initializing an array of structures

    I am writing a program in C (vanilla, non-C++/C#) and I am having trouble figuring out why my initialization of my array of structures isn't working. I have tried a number of things without any luck. I still get a compiler error: "conflicting types for 'cardInfo' " I am writing a simple...
  44. G

    Fortran How can I read a 2D character array in Fortran using f90?

    Hello all, I have some data stored in character*1 array(value,value) apparently the code is in f77, i got the original reading code for the data as a text... I am working in f90, and to the extend of my knowledge (not much in fortran) I can not declare such 2D array as character...
  45. H

    How can I limit the array in MathCAD to prevent crashing?

    Homework Statement I don't know how to limit the array. I know that the program crashed because it exceeds the array end points at zero and maximum position and time. But how can I tell MathCAD not to do so? I'm stuck without any idea! Can anyone who can show me the code lines I should...
  46. A

    Solving Array Homework: Output Explained

    Homework Statement say a[5] = { 5.6, -3.2, 11, -7.7, -1 ); and b = 5 void fum ( double a[], int b ){ for ( int i = b -1; i >= 0; i-- ){ if ( a[i] < 0 ) cout << -a[i]; else cout << a[i]; cout << ", "; } } Why is the output 1, 7.7, 11, 3.2, 5.6 and not 7.7...
  47. iamjon.smith

    Comp Sci Solve Java Array Issue: Unique Numbers 10-100

    Simple Array assignment, directions as follows: (Must be implemented using a one-dimensional array.) Write an application that inputs ten numbers from the user, each number can be between 10 and 100, inclusive. As each number is read in determine if it is a number already entered. If it is...
  48. A

    Find Array Mapping Homework Solution

    Homework Statement I don't know if this has ties to linear algebra, so sorry in advance if I'm posting in a wrong section. We have an n*n matrix A, n is an odd number, and "the matrix's sides are 0" meaning: we'll call non-zero elements as 1's for now.1st line 1111...1111 2nd line 0111...1110...
  49. T

    What Determines the Rank of a 2x2x2 Tensor?

    Rank of a tensor--- 2x2x2 Array Can anybody give me an example of 2x2x2 Array whose tensor rank is 2 or Can somebody show me why the tensor rank is two for the following 2x2x2 array. That is can you express as a sum of 2 outer products? I am giving the entries of the first face and then...
  50. S

    Solar array design for solar car

    hello, our team has a solar car project, and i am in charge of the solar array system. Now we have an average silicon solar cell of Voc 0.6 V and Isc 6 A, thus 3.5 W of power. We are given 6 sq. meter of area to cover with solar cells. This corresponds to around 2300 standard sized solar...
Back
Top