Answered
Writing a script to take a text file and display the second word in each even numbered row
One of the simplest ways to do this is by looping through each line with fgetl, and splitting the appropriate lines with regexp....

5 years ago | 0

Answered
Program that can take three lines input by the user running the code, and saves those lines of text in a text file
There are a couple of different ways of doing this, mostly based on how much you trust the user to put things in correctly. The...

5 years ago | 0

Answered
Excel (.csv) error: "Excel Worksheet could not be activated.""
A .csv file is not actually an excel format, although it can be opened with excel. I would suggest using csvread() instead, as i...

5 years ago | 0

Answered
Naming new sets of data in for loop and dividing matrixes.
Why not just load the data into a third dimension from the beginning? for p = -10:10 filename = strcat('mea...

5 years ago | 0

| accepted

Answered
Hello everyone, help for consolidation of numbers
One convoluted way of doing this would be to convert to strings and back. for i = 1:length(A)/3 B(i) = str2num([num2str(A(...

5 years ago | 0

| accepted

Answered
string to text file
Take a look here for ways to write data in variables to text files.

5 years ago | 0

Answered
create table that count the composition of two categories.
Loading things with one command is generally always preferred, so yes, combining them into a 562x2 array is helpful. As for the...

5 years ago | 1

Answered
Extracting two-dimensional data matrix from .csv into individual variables
I'm not sure I entirely understand what you're trying to accomplish so I'm going to break things down. Feel free to let me know ...

5 years ago | 0

Answered
how to delete rows from a struct array?
vars = vars([vars.class] == 'double'); This may not work exactly (I think you might need to use strcmp instead of ==, but it sh...

5 years ago | 0

Answered
How do I create an excel file from a cell array that actually displays all the information in each colum?
I would suggest reformatting your data first, so that you have everything in the upper level of cells. for i = 1:size(result) ...

5 years ago | 0

Answered
How to edit text file in matlab?
I don't know that it is worth the effort to actually edit a text file with MATLAB, but it is certainly possible to read it, edit...

5 years ago | 0

| accepted

Answered
How to replace array values that meet condition?
I'm assuming B_1 should be the same size as B? Does order matter? If order doesn't matter: A = [3 4 5]; B = [4 6 3]; B...

5 years ago | 0

Answered
How to run completely a loop inside one other?
I suspect that the issue is not that the code actually stops, but that the results are only recorded for one internal loop. If y...

5 years ago | 0

| accepted

Answered
Adding an outer for loop for a plot
eta = [5.4 6.7 5.2]; hold on for i = 1:length(eta); eta_c = 0.6; rpf = eta(i)/eta_c; count = 0; for x = 1:...

5 years ago | 1

| accepted

Answered
Error in my "for" loop?
Currently your 'first' loop only loops through one set of indices, but you want it to loop through all c, s, and t values indivi...

5 years ago | 1

| accepted

Answered
Results of a while loop wont store in array
You need to index your result within the loop. x=[10:100]; a=10; b=100; c=0; resultsvector=[]; count = 0; %%%%%%%%%%%%%% ...

5 years ago | 0

| accepted

Answered
plotting in a loop with a function
You need to index z with each loop. count = 0; for x = 1:0.01:1.5; count = count + 1; z(count) = g(x,rpf); end plo...

5 years ago | 0

| accepted

Answered
Only the value corresponding to the last loop of a for loop being saved in the output array
You're getting the error because OCV(k) is a single element, and I suspect that Volt(A) is not. For the problem of only getti...

5 years ago | 1

Answered
Please could someone explain the basics of how MATLAB updates codes in a script?
Did you delete and repost this question? I swear I saw it earlier today. A couple of things about your code. 1) It doesn't l...

5 years ago | 1

| accepted

Answered
How can i loop a matrix without knowing is size?
So, you have two matrices, one outside the loop, and one inside? Which one are you not sure about the size of? If it is the out...

5 years ago | 0

| accepted

Answered
refrencing elements kindly explain each one
1) The first and second statements are really just the same thing, which is defining contents of matrices A and b. We know they ...

5 years ago | 0

| accepted

Answered
How to perform for-loop over sequential arrays?
It is generally always a bad idea to label variables as x1, x2, etc. because it means you have intentions of creating multiple v...

5 years ago | 0

Answered
saving 3 dimensional single data in an Excel file
xlswrite is only able to write data in a 2D format because it can only write to one sheet at a time. In order to write your 3D d...

5 years ago | 1

| accepted

Answered
How do I plot multiple, disparate lines onto one graph showing changes between 2 conditions?
I would suggest a quick loop through each of your subjects. You can keep multiple lines on a single plot by using the hold comma...

5 years ago | 0

| accepted

Answered
Find the min for each plane of a multidimensional array
A = randi(100,3,3,3); % Sample input [m,r] = min(A,[],1); % Locate minimum value for all rows [m,c] = min(m,[],2); % Locate ...

5 years ago | 0

Answered
delete rows from matrix if some of its elements equal all elements in another rows another different dimension matrix?
Sorry I couldn't come up with any way of doing it without a for loop. Others might know a better way of performing this, but her...

5 years ago | 1

| accepted

Answered
Importing IQ samples into the matlab
I'm assuming that '.biniq' is readable as an ascii file. If that is true then here are some options for loading the data: texts...

5 years ago | 0

Answered
combine data according to values in another vector in matlab
I know others can probably do better than I can at this, but here goes. data = [t; vals]; tims = uniques(t); for i = 1:length...

5 years ago | 0

| accepted

Answered
How to plot streamlines in matlab ???
Try using the quiver function. It's not perfect streamlines, but it should give you an idea of what the velocity field looks lik...

5 years ago | 0

Answered
How do I declare E=[1,-7,3,-9,5]
You can define each element of an array individually if you would like. Defining E should be pretty much exactly as it is listed...

5 years ago | 0

| accepted

Load more