Array Definition and 481 Threads
-
L
Fortran Fortran 90/95: Array Help with IF Statement
Hi, For fortran 90/95, I've written a 10x10 array of numbers. 2 do loops (n,m) from 1 to 10 indicate the subscript of the elements in this array. I've applied a generic rule to the array elements where they become 0 if they are above a certain number. Using an if statement to change the...- Lukejambo
- Thread
- Array Fortran Fortran95
- Replies: 2
- Forum: Programming and Computer Science
-
Comp Sci Allocatable character array in Fortran
Homework Statement I have character array in fortran which is defined as allocatable. When program runs, user inputs something like: [1,2,3,4...], and then program reads it and counts the particles, and then allocate array with dimension it just read. Thats' how I understood it. This program...- Antonija
- Thread
- Array Fortran
- Replies: 7
- Forum: Engineering and Comp Sci Homework Help
-
B
DOUBLE cannot convert the input expression into double array
Hi Folks, I have a symbolic A=18*1*18 array containing symbols/expressions. I want to populate certain entries of this array into another matrix. For example K(1,1)=A(1,1,1) I get the following ? The following error occurred converting from sym to double: Error using ==> mupadmex Error in...- bugatti79
- Thread
- Array Convert Expression Input
- Replies: 2
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
B
Far-field power-pattern of the antenna array Beam-Steering
Hi all, I have a problem to firstly understand and secondly solve this problem : here is the Problem : Consider three (coherent) antennas variously arranged on the x-y-plane where each individual antenna radiates an isotropic electric field E(x). 1 - Write down an expression for the far-field...- banigeo
- Thread
- Antenna Array
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
How to check whether an array represents max heap
Homework Statement Does the following array represents the binary max heap 99,98,97,55,49,49,48,13,54 99,98,97,55,54,49,49,48,13 Homework EquationsThe Attempt at a Solution I've tried to construct the tree structure and all the above array representation satisfies the binary max heap property...- 22990atinesh
- Thread
- Array Max Tree
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
M
Matlab Issue with aligning text in table format in .txt file
Homework Statement uData is a 30x5 matrix with numbers. name_Database is a 30x1 cell array with strings of Names (e.g. Fake Subject 1, Fake Subject 2, Bob). What would fix the code so that the data aligns? (please see image for the misalignment). Homework EquationsThe Attempt at a Solution...- muaaman
- Thread
- Array Cell File Format Matlab Matrix Table Text
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
C/C++ [C++] Reading a binary file into a byte array
I have to read a binary file into a byte array and chop it wherever I like. I'd like to use a vector of char to do this. But reading some resources from known people, I find they tend to use char* or char []. Using a vector of chars seems easier for retrieval of any block of bytes. Which means...- Silicon Waffle
- Thread
- Array Binary File Reading
- Replies: 3
- Forum: Programming and Computer Science
-
MHB Explore the Manipulated Contents of an Array with Multiplication and Addition
Please identify the contents of the array after the following manipulations. int arr[5]; arr[0] = 2; arr[1] = arr[0] + 1; arr[2] = arr[0] * arr[1]; arr[3] = arr[1] / arr[0]; arr[4] = arr[3] * arr[3]; *Involves multiplication, addition from the array. Solve it...- Henry R
- Thread
- Array
- Replies: 8
- Forum: Programming and Computer Science
-
Comp Sci Efficient Fortran Method for Trajectory Plotting with 4d Vector-First Order ODE
Homework Statement I have a code that successfully plots the trajectory of a ball moving under gravity and air resistance, but my method is rather long-winded and I want to use a 4d vector-first order ODE instead - but I don't know how to do it. I've tried writing some simple skeletons but...- SalfordPhysics
- Thread
- Array Arrays Euler formula Fortran Multidimensional
- Replies: 18
- Forum: Engineering and Comp Sci Homework Help
-
M
MHB Why Use a Helper Variable When Inserting an Element in an Array?
Hey! :o How can I insert an element in an array in time complexity O(1)? What variables do I have to use to achieve this? (Wondering)- mathmari
- Thread
- Array
- Replies: 98
- Forum: Programming and Computer Science
-
I
C/C++ Accessing Array Elements: i vs. .at(i)
ok I am a little confused. can both [i] and .at(i) be used to same way to access an array element?- ineedhelpnow
- Thread
- Array Elements
- Replies: 1
- Forum: Programming and Computer Science
-
M
C/C++ C++ - dynamically allocating memory to array of structs
Let me start by saying I know this is a funky way to program, but my teacher is requiring us to go about it this way. also: I CANT use std::string, classes, constructors for this project. I am required to use this archaic method of c-style strings with dynamic memory allocation occurring...- mattskie
- Thread
- Array C++ Memory
- Replies: 10
- Forum: Programming and Computer Science
-
How Can You Determine the Number of Strings in a C++ Static Array?
1. Using new to create a memory block for a static array of strings. How to know the number of strings in an array of strings Homework Equations new The Attempt at a Solution 1. static char ** array=new char*[]; // why the empty [] ? Will I get a minus point if coding like this ...- Medicol
- Thread
- Array Memory
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
Getting input from an array of textboxes for another window (wpf)
Hi, I am working on an n-body solver. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input...- DivergentSpectrum
- Thread
- Array Input Window
- Replies: 7
- Forum: Programming and Computer Science
-
Fortran Can equations be used in Fortran array declarations with parameters?
Hi, I'm just wondering real quick, are equations allowed in array declarations? For example: int :: y=2 int, dimension(2*y):: x ?- Matterwave
- Thread
- Array Fortran
- Replies: 4
- Forum: Programming and Computer Science
-
N
Plano-convex vs Double-convex (fly's eye) cylindrical microlens array
I am trying to find out if I could substitute a Plano-convex cylindrical microlens array with a Double-convex (fly's eye) cylindrical microlens array for laser beam homogenization in 1 dimension. Assuming that the lens parameters are the same, how would the quality of performance be affected...- NazRB
- Thread
- Array Cylindrical Eye
- Replies: 2
- Forum: General Engineering
-
E
Calculating Probability for Array of Balls
Hi! Here is my task: There are 4 white and 6 red balls in array. Find probability that there are three white balls in beginning of array. How to calculate m?- etf
- Thread
- Array Balls Probability
- Replies: 3
- Forum: Calculus and Beyond Homework Help
-
Cell Array manipulation (matlab)
Homework Statement Write a line of MATLAB code that uses the cell array A to generate the string 'Cal Golden Bears'Homework Equations The Attempt at a Solution A = {'Cal', 'Golden', 'Bears', [5 7], {[1 2 3 4]}} A = 'Cal' 'Golden' 'Bears' [1x2 double] {1x1 cell} The...- gfd43tg
- Thread
- Array Cell Manipulation Matlab
- Replies: 3
- Forum: Engineering and Comp Sci Homework Help
-
C# How Can I Replicate PHP Array Addition in C#?
The title. A friend of me told me the code in php <?php for($i=0; $i<=100; $i++) { if($i%5==0) { $out[] = $i; } } foreach($out as $val) { echo $val."<br>"; } ?> The result is the multiples of 5 in the first 100. How do I reproduce this part:"$out[] = $i...- adjacent
- Thread
- Array
- Replies: 3
- Forum: Programming and Computer Science
-
M
Array multiplication and array division
Hi, in Matlab I encounter with two new operations for me which are array multiplication and array division. I want to learn that do they have physical applications in real world physics problems or are they be related with banking and accounting.- mech-eng
- Thread
- Array Division Multiplication
- Replies: 8
- Forum: General Math
-
While end loop to find pattern in array
Homework Statement Write code using a while loop that will assign to the variable numOccursSep the number of times a certain pattern of 0's and 1's occurs separately in V. The variable pattern gives the certain pattern to look for. For this problem overlap is not allowed, i.e. if pattern =...- gfd43tg
- Thread
- Array Loop
- Replies: 8
- Forum: Engineering and Comp Sci Homework Help
-
Loops to create an array (matlab)
Homework Statement Attached imageHomework Equations The Attempt at a Solution I am basing my code off a template I found in a textbook for using loops to create an array. If I didn't find this example I don't think I would even know where to begin with this. Here is what I came up with so far...- gfd43tg
- Thread
- Array Loops Matlab
- Replies: 6
- Forum: Engineering and Comp Sci Homework Help
-
Mean distance between points of 2D array
Say I have an N X N array of points, I would like a formula to give the mean distance between the points. There are lots of short distances but only two long ones (diagonal). There are plenty of algorithms to do this but I would like to work out a formula if there is one. Can someone point me in...- cosmik debris
- Thread
- 2d Array Mean Points
- Replies: 5
- Forum: General Math
-
Matlab changing word in character array
Homework Statement Let sentence1, string1, and string2 be three variables whose values are character strings. Using only the MATLAB function strfind and array concatenation, write code that will replace the first occurrence of string1 in sentence1 with string2, assigning the result to...- gfd43tg
- Thread
- Array Matlab
- Replies: 4
- Forum: Engineering and Comp Sci Homework Help
-
What is the Purpose of Using Arrays in Complex Expressions?
Homework Statement I am working on problem 4 in the PDF attachment now, but I will show my code for 2 and 3 since they are related to 4. The values for 2 and 3 were given in the editor. Homework Equations The Attempt at a Solution 2. P = [1.6, 4, 2.9, -8]; N = 3; PextDown = repmat(P,3,1)...- gfd43tg
- Thread
- Array Complex Expression
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
Concatenating 2D Array: Adding Rows | Step-by-Step Guide for Problem 1(d)"
Homework Statement I'm working on problem 1, specifically part (d) in the attached PDF file. I will show my code for (a) - (c) so you can see where I am coming fromHomework Equations The Attempt at a Solution (a) A1 = [1.3 5.2; 7.4 3.8; 9 2] A1 = 1.3000 5.2000 7.4000 3.8000...- gfd43tg
- Thread
- 2d Array
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
Character array command to find # of specific word in a paragraph
Homework Statement Download the mat file Gettysburg.mat. View in a new window and load it in the workspace using the command clear; load Gettysburg; This loads a 1-by-1452 char array GA that is the Gettysburg Address in English. Display the first 100 or so characters for yourself to see this...- gfd43tg
- Thread
- Array Specific
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
What is the purpose of max(A,[],1)?
Homework Statement Homework Equations The Attempt at a Solution A = [2.1, 4.2, 6.7; 8.3, 5.3, 5.4] A = 2.1000 4.2000 6.7000 8.3000 5.3000 5.4000 [mVal, I] = max(A,[],1) mVal = 8.3000 5.3000 6.7000I = 2 2 1 I don't understand what max(A,[],1) is...- gfd43tg
- Thread
- 2d Array Data Manipulation
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
Index notation matlab for 2D array
Homework Statement Homework Equations The Attempt at a Solution Hello, I am having some confusion over the notation used in matlab. I don't really know what they mean A = [1:3; 4:6; 7:9] A = 1 2 3 4 5 6 7 8 9 A(1:2, 1:2) ans = 1 2...- gfd43tg
- Thread
- 2d Array Index Index notation Matlab Notation
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
F
Diffraction with a large array of slits
Hi all, exams soon and I'm stressing out over this small question. If anyone could guide me through, explaining why you're doing what you're doing that'd be beyond great. I posted this in the introductory thread but with no replies thought I should move it here (unsure of how to delete the other...- Flucky
- Thread
- Array Diffraction
- Replies: 4
- Forum: Advanced Physics Homework Help
-
F
Diffraction with a large array of slits
Hi all, exams soon and I'm stressing out over this small question. If anyone could guide me through, explaining why you're doing what you're doing that'd be beyond great. Homework Statement Light of wavelength λ is incident normally on a screen with a large array of slits having equal widths...- Flucky
- Thread
- Array Diffraction
- Replies: 2
- Forum: Introductory Physics Homework Help
-
H
Fortran Fortran: How to make a long character made with an array
Lets see if I explain myself. I want to FILL a string with the components of a character array. I have no idea, but seeing this example: character(len=*),parameter::fname=" Paul",lname="Scholes" character(len=20)::fullname fullname=fname//" "//lname I try this one...- hodei_cloud
- Thread
- Array Fortran
- Replies: 4
- Forum: Programming and Computer Science
-
A
Fortran Array Reference is out of bounds error? Fortran
So, I have a bunch of errors which need resolving here but majority are based on the "out of bounds" error and hence the topic title :). Would be great if you are able to help me resolve the errors. Quite a newbie with fortran. So please bear with any silly questions that I may throw at you...- adishpatel
- Thread
- Array Bounds Error Fortran Reference
- Replies: 11
- Forum: Programming and Computer Science
-
B
The Force of an Array of Perm. Magnets on a Large Iron Body
For my senior physics research project I've developed an orbital analysis program that calculates the minimum \Delta V required (applied in an instantaneous impulse) to deflect an inbound Earth impacting asteroid. I've generated data for several different hypothetical orbits and now my advisor...- Bobbo Snap
- Thread
- Array Body Force Iron Magnets
- Replies: 5
- Forum: Electromagnetism
-
R
Having trouble with CSC assignment. Trying to make an array of Strings
Homework Statement I need to write a program that takes a text file, and looks for how many unique words it has, as well as the number of times they occur in the file. Homework Equations None The Attempt at a Solution public static void main(String[] args) throws FileNotFoundException {...- richyw
- Thread
- Array Assignment Strings
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
M
Array reduction for a reaction matrix
Homework Statement My problem is with a portion of a much larger problem, I'm working on an exercise involving the production of synthesis gas in where there's a reactor in which it is postulated that the following reactions take place: CH4 + CO2 ⇔ 2CO + 2H2 CO + H2O ⇔ CO2 + H2 CH4 + H2O ⇔ CO...- Mangoes
- Thread
- Array Matrix Reaction Reduction
- Replies: 2
- Forum: Biology and Chemistry Homework Help
-
E
MATLAB Matlab : Function handle givin array to cell array of function handles
Hi. I am currently in a situation where I have a function handle giving as putput an array of doubles. I would like to convert this to a cell array of function handles, each giving a component of the previous array. The original function handle is produced by a built-in MATLAB function, so...- espen180
- Thread
- Array Cell Function Matlab
- Replies: 1
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
S
Fortran FORTRAN error array bound is not scalar integer
FORTRAN error "array bound is not scalar integer" I'd like to know if a loop can be created, inside which I can call a subroutine in which there are arrays to be defined whose size varies as a function of loop variable. I tried as following, but got error "array bound is not scalar integer"...- sathish
- Thread
- Array Bound Error Fortran Integer Scalar
- Replies: 4
- Forum: Programming and Computer Science
-
T
Python Python (Numpy) Non-Elementwise Array Operations
Python (numpy) question: I have two 2D numpy arrays, A[i,j] and B[k,l], but the indexes are unrelated to each other (A and B won't even have the same dimensions in general). I want to be able to add/multiply these two together to get a 4D matrix: C[i,j,k,l] = A[i,j] + B[k,l] or C[i,j,k,l] =...- thegreenlaser
- Thread
- Array Numpy Operations Python
- Replies: 14
- Forum: Programming and Computer Science
-
I
Array of magnets around a sphere
An array of N magnets which can turn freely about their centers in any direction in 3d space is distributed uniformly around a spherical surface (their centers). What is the configuration of equilibrium of the system after some time? (minimum energy) Do you know of any work showing that...- intervoxel
- Thread
- Array Magnets Sphere
- Replies: 4
- Forum: Electromagnetism
-
N
C programming: array declared before main() and initialised in main()
Hello! I am sure I am again missing something obvious: I tried to declare the array and assing value within main() as follows: #include <stdio.h> float array_1[10]; int main( void ) { array_1[10] = { 1,1,2,3,4,5,6,7,8,9 }; ...other stuff... return 0; } I can declare and...- nobahar
- Thread
- Array C programming Programming
- Replies: 9
- Forum: Programming and Computer Science
-
S
Geolocation of emitters using an interferometer array
Hello, in a paper about geolocation of emitters using an interferometer array I read such a description about a kind of array: Such arrays support locating emitters using some form of triangulation or bearings-only geolocation over several dwells as the satellite moves in its orbit. I...- senmeis
- Thread
- Array Interferometer
- Replies: 9
- Forum: General Engineering
-
M
Runge-Kutta 4 order method. Severe 161: Array bounds exceeded.
So here I am trying to solve Rayleigh's differential equation using Rungen-Kutta 4th order analytic method. This is what the exercise gives me: X(0 to 40), Y1(0)=0.1, Y2(0)=0, H=0.1, μ=0.5 This is what I ve written and gives me this error: IMPLICIT REAL*8(A-K,O-Z) DIMENSION...- Metalman9
- Thread
- Array Bounds Method Runge-kutta
- Replies: 3
- Forum: Programming and Computer Science
-
N
Analytic expression to find the range of non-negative numbers in array
Hello, I have an array of length M. Some of the indices are non-negative. I need to derive a function/analytic expression (preferably linear or convex) that finds the span of indices for which the indices are non-negative. Example: Let p denote the desired vector. Let, p = [0 0 0.3 2.6...- nazmul.islam
- Thread
- Array Expression Numbers Range
- Replies: 2
- Forum: Linear and Abstract Algebra
-
I
Fortran Fortran90 issue: nonzero out of bounds array elements
Hi to all. I am programing a new code for some calculation and i have detected a strange issue. I have my all arrays strictly defined for example real, dimension(-2:2,-3:2) A, B complex, dimension(-2:2,1:2) C In my time dependend calculations i expect the matrix element C(-2,1) to...- ilvreth
- Thread
- Array Bounds Elements Fortran90
- Replies: 3
- Forum: Programming and Computer Science
-
MHB How to typeset an array of figures?
I want to typeset a 3 x 2 array of figures (that is, three rows of two columns), for answers to a multiple-choice question. How can I do that? The standard \begin{figure} environment seems to want to be outside of any environment. Ideas?- Ackbach
- Thread
- Array
- Replies: 2
- Forum: MATLAB, Maple, Mathematica, LaTeX
-
A
How Do You Calculate the Memory Address of Temp[40,30,20] in a 3D Array?
Homework Statement The problem is finding the memory location of a three-dimentional array Temp. Each index of temp goes from 1 to 100 and each element stores 4 bytes. The array is setup such that the last index varies fastest, aka: Temp[1,1,1], Temp[1,1,2], ... Temp[1,1,100]...- acadian
- Thread
- 3d Array Memory
- Replies: 2
- Forum: Engineering and Comp Sci Homework Help
-
P
MATLAB - forming an array of sums?
Hi, Homework Statement I am asked to evaluate the following sum S=Sigma(n=0 to N) x^n/n! (namely, e^x as n->Inf) for N=10:10:100 and x=10, so that every element S(i) is a partial sum which approximates function e^x with different accuracy. Below is my code, which doesn't work. Homework...- peripatein
- Thread
- Array Matlab Sums
- Replies: 1
- Forum: Engineering and Comp Sci Homework Help
-
B
C linked list with an array inside
I have pasted my code here : http://pastebin.com/nMNarH9i It is in language C. Basically, I am reading in 5 numbers at a time. Putting these numbers in array one_vote_array. Then I need to put this array in a structure vote_node. I also then change my next pointer in the structure to head...- baddin
- Thread
- Array List
- Replies: 9
- Forum: Programming and Computer Science
-
C
[C] Errors passing bidimensional array to a funcion
Hi I have these functions: void posicaoIfElse (int e [][n], int i, int j, int k, int m, int n) { ... ... } void posicaoFormula (int e [][n], int i, int j, int k, int m, int n) { ... ... } that I calls through posicaoFormula (e,i,j,k,m,n); printf ("\n"); posicaoIfElse...- colt
- Thread
- Array Errors
- Replies: 5
- Forum: Programming and Computer Science