Community Profile

# g

Last seen: 2 years ago Active since 2018

#### Content Feed

View by

Question

Writing row vectors to file
I am currently using the following scheme to write the row vectors Vec_A and Vec_B to a file: fid = fopen('myfile.dat','wt'); ...

3 years ago | 2 answers | 0

### 2

Question

Iterating over values in multiple arrays
Let's say I have an array A defined as A = [0 2 5 7 8] Let's say I haven array B defined as B = linspace[0,10,100] Now I wan...

3 years ago | 1 answer | 0

### 1

Question

Performing calculations (Newton's method) over values in loop
I am trying to perform Newton's method over a series of values given by the array p_init. I am trying to perform Newton's metho...

3 years ago | 1 answer | 0

### 1

Question

Renaming files in directory that meet array criterion
Let's say I have some files in a directory my_directory: file_23.txt file_35.txt file_37.txt I'm reading the files through ...

3 years ago | 1 answer | 0

### 1

Question

Check if values in array fall within certain integer of values in another array
Let's say I have a set of numbers in array A 11 22 35 41 and another set of numbers in array B 3 11 45 I want to check ...

3 years ago | 2 answers | 0

### 2

Question

Renaming files if they meet certain array conditions
I have some arbitrary files in a directory "my_directory": file_1002.txt file_1012.txt file_1023.txt file_2045.txt each wit...

3 years ago | 1 answer | 0

### 1

Question

Extracting values from file names to array
Let's say I have a directory "mydirectory" and in it, I have some files file_234.txt file_356.txt file_567.txt file_987.txt ...

3 years ago | 2 answers | 0

### 2

Question

Determine whether file value is within certain integer of an array value
I have some arbitrary files in a directory "my_directory": file_1002.txt file_1012.txt file_1023.txt file_2045.txt each wit...

3 years ago | 1 answer | 0

### 1

Question

Counting values between values in array
I have a variable, call it var, containing thousands of rows of numbers, like so: 123 124 125 128 % some values skipped 129...

3 years ago | 1 answer | 0

### 1

Question

Forcing matrices to match in size
Let's say I have two single-row matrices A and B. I want to check if A and B have the same number of columns. If they do, do no...

3 years ago | 2 answers | 0

### 2

Question

Why is my if statement breaking when condition is not met?
So I have a program that sets verbose to either 'true' or 'false' I have the code if (verbose == 'true') fprintf('VERBOSE ...

3 years ago | 2 answers | 0

### 2

Question

Ignoring comments in lines when parsing
I am parsing a file with the following code: C = textscan(fid,fmt,opt{:},'CommentStyle','#'); This works in ignoring comments...

4 years ago | 2 answers | 0

### 2

Question

Importing data from a file in a specific way
I have a file with 3 columns of data. Here is just a sample of what the data looks like (there are many more rows): 265.545555...

4 years ago | 2 answers | 0

### 2

Question

Passing values to Bash script
Let's say I have a matlab file that calculates some values, giving: alpha = 7 beta = 9 Now, I want to pass these values to a ...

4 years ago | 1 answer | 0

### 1

Question

Replace regular expression in file name
I want to use regular expressions replacement for file names in the following way. Say I have a string '/home/directory1/sub' ...

4 years ago | 2 answers | 0

### 2

Question

I am currently parsing a file using the following scheme. fmt = '%s%s'; opt = {'Delimiter','='}; [fid,msg]=fopen(file,'rt'); ...

4 years ago | 1 answer | 0

### 1

Question

Running Matlab script from another directory
I currently have a script with the following line. What it does is opens matlab and passes the file to mymatlabscript, then exit...

4 years ago | 1 answer | 0

### 1

Question

Skipping elseif when first condition is true
I currently have the following scheme: if (a =0) q = 4 elseif (b=0) q = 5 rest of code end The problem is, in the case ...

4 years ago | 2 answers | 0

### 2

Question

Printing just one column in text file in scientific notation
I am creating a text file with two columns of data using the following scheme: data = [a b] datafile = sprintf('file_%s.txt',l...

4 years ago | 1 answer | 0

### 1

Question

Questions about producing text file with data
I have some data that contains two columns, and I want to print that data to a text file. This is my current scheme: fileID = f...

4 years ago | 1 answer | 0

### 1

Question

Creating text file with columns of data
How do I create a text file with two columns of text correspond to columns of data? I currently have data = [a b]; % a and b ...

4 years ago | 1 answer | 2

### 1

Question

Making one structure out of two structures
Let's say I have two structures. D = [strtrim(C{1}),num2cell(C{2})].'; F = struct(D...

4 years ago | 2 answers | 0

### 2

Question

How to parse variables independent of order
I am currently opening a file and parsing arguments in the following way: ReadParam = 'h0 = %f f0 = %f'; fid = fopen(file); p...

4 years ago | 1 answer | 0

### 1

Question

How to pass file from Bash script to MATLAB script
I have a bash script that creates a config file of varying name and then runs a Matlab script through the following: (config fi...

4 years ago | 1 answer | 0

### 1

Question

Editing values in Matlab script from Bash script
Let's say I have a script called Histogram.m that performs a variety of functions. It has a variable named Detect that can be...

4 years ago | 1 answer | 1

### 1

Question

Indexing values, selecting a range, and outputting values
Let's say I have two sets of data. A = [1 2 3 4 5 6 7 8 9 10] B = [4 5 2 8 9 0 1 0 4 6 ] Let's say I only care about va...

4 years ago | 1 answer | 0

### 1

Question

How to pick and subtract specific elements in matrices
Let's say I have four sets of data (a,b,c,d). Arbitrary values chosen. a = [1 2 3 4 5 6 7 8 9 10] b = [0 4 2 8 5 5 6 2 1 9...

4 years ago | 1 answer | 0

### 1

Question

How to plot separate scripts into one plot
If I have two Matlab scripts, for example "apple.m" and "ball.m" that plot with the same axes (just different data), etc. how ca...

4 years ago | 1 answer | 0