Answered
how to extract a specific text from text file
>> C = {'1;158.798;281.117;99.858;39.855;2182;'}; >> D = regexp(C,';','split'); >> D{1}(2:5) ans = '158.798' ...

8 years ago | 1

| accepted

Answered
How to sum multiple matrices?
_"I'm new in matlab and I need some help please. I have 12 matrix s1...s12..."_ That is the problem right there. Numbered var...

8 years ago | 0

| accepted

Answered
Brace indexing is not supported for variables of this type. Error in cell2mat (line 36) if isnumeric(c{1}) || ischar(c{1}) || islogical(c{1}) || isstruct(c{1}) Error in NRMVRR (line 13) m=cell2mat(f);
I fixed up the first part of your code. Your code has many bugs, you actually need to read the MATLAB documentation to learn how...

8 years ago | 0

Answered
Fixunknowns function resulting logical rows
Where |M| is the output matrix: new = M(1:2:end,:)

8 years ago | 0

| accepted

Answered
find if the variable exists in a given cell-structure
Use <https://www.mathworks.com/help/matlab/ref/isfield.html |isfield|> to test if a structure has a particular field: isfie...

8 years ago | 0

| accepted

Answered
openfig has the error 'The value of 'Filename' is invalid. It must satisfy the function: ischar.'
You used the wrong indexing for the cell array. You need to use curly braces: openfig((f_range_name{I})) ...

8 years ago | 0

| accepted

Answered
Using a variable name as the name of a file structure
Although your explanation is not very clear, it seems that your |.mat| file contain one variable, which happens to be a structur...

8 years ago | 0

Answered
how do i write a for loop to eliminate point under a certain value?
With basic indexing: Ti_x(Ti_x<=0.25) = NaN NaN values do not get plotted.

8 years ago | 0

| accepted

Answered
Suppose i have matrix the first and second column represent x,y-coordinates and third column is cluster id
*Method One:* <https://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|>: >> R = 1:size(M,1); >> C = accum...

8 years ago | 0

| accepted

Answered
Reading 100 image in a loop and save them in a Matrix
You should follow the examples in the MATLAB documentation, rather than using awful |eval| and |cd|: <https://www.mathworks.c...

8 years ago | 0

Answered
Error using vertcat Dimensions of arrays being concatenated are not consistent.
The problem is how you have written your vector with random space characters. For example this: 1.7e-3 -(y(12))*(y(14))/(y(...

8 years ago | 1

Answered
How to read input images from the folder sequentially
Presumably the filenames have numbers in them, and you are getting them listed not in numeric order...One solution is to downloa...

8 years ago | 0

Answered
Could anyone help me to solve the issue
You need to actually look at the data that you are plotting: what magnitude do they have? Your data are of order 1e13, 1e9, and ...

8 years ago | 1

Answered
How to combine 3 (or more) separate CSV files into one Excel file with multiple sheets
D = 'path of folder where the CSV files are'; S = dir(fullfile(D,'*.CSV')); for k = 1:numel(S) mat = csvread(full...

8 years ago | 0

| accepted

Answered
i want to save names of the images(frame_0000, frame_0001, frame_0003........) in a text file by reading them from a folder.
D = 'directory where images are'; S = dir(fullfile(D,'*.jpg')); % Save filenames: [fid,msg] = fopen('names.txt','wt')...

8 years ago | 1

| accepted

Answered
Writing ASCII symbols by using fprintf
Windows only: [fid,msg] = fopen('file.txt','wt'); % open in text mode! assert(fid>=3,msg) fprintf(fid,'...\n',yourArr...

8 years ago | 0

| accepted

Answered
how to write a code in which the output of a one function will be out put to an other function.?
This is easy, assuming that each function has just one input and output. Try this: C = {@fun1,@fun2,@fun3,@fun4,@fun5}; % c...

8 years ago | 1

Answered
rounding a column vector
This will round values from (X-1).9 to (X).1 to the integer X, otherwise leave the rounded values alone: >> vec = 1:0.1:2 ...

8 years ago | 1

| accepted

Answered
Vector/martix limit size?
Your code is buggy, and that concept will fail for 3D arrays. Try this instead: isrow(v) && numel(v)==3 OR isequal(...

8 years ago | 0

| accepted

Answered
Read a vector from Excel and use it in several functions in a code
Pass the data as input arguments. This is explained well in the MATLAB documentation: * How to define functions with input ar...

8 years ago | 0

Answered
How can I preallocate for speed instead of concatenating changing size column vectors in a loop?
Doing everything with loops is not an effective use of MATLAB. Here I used some basic vector operations and |repmat| to replace ...

8 years ago | 0

| accepted

Answered
Write in Excel file huge matrix
Excel simply cannot display that many rows, no matter how much you want it to. _"...even if Matlab tells me it works, when I ...

8 years ago | 0

| accepted

Answered
Storing data in for loop
Get rid of the most of the loops, they don't help you. Learn how to write vectorized code. Here is your code, simplified: m...

8 years ago | 1

Answered
how to read a txt file having alphanumeric data and special characters. ? My text file is like this. I tried textread but could not get a result. any suggestion.
Here is an efficient solution using <https://www.mathworks.com/help/matlab/ref/textscan.html |textscan|>. The test file is attac...

8 years ago | 1

| accepted

Answered
How do I threshold only real part of a complex matrix?
>> A = complex(randi([-3,3],4,4),randi([-3,3],4,4)) % fake data A = -2 + 3i -2 + 1i 2 - 3i -2 + 1i -2 + 0i ...

8 years ago | 0

| accepted

Answered
How to set multiple variables at once?
_"I wonder if I can set multiple variables at once"_ Not in the way that you are trying to do, because MATLAB is not Python (...

8 years ago | 3

| accepted

Answered
how to combine three variables from two different .mat files
Probably all you need is something like this: S = load('grid.mat'); T = load('second.mat'); X = S.X; Y = S.Y; Z...

8 years ago | 0

Answered
How do I combine 2d matrices mat files into a single 3d matrices file?
Something like this should get you started. This will load the data from all of the |.mat| files in the specified directory, con...

8 years ago | 0

| accepted

Answered
Find index of pattern match
>> str = 'Mary had a little lamb'; >> pat = {'big','little','small'}; >> idx = ~cellfun('isempty',strfind(str,pat)) i...

8 years ago | 0

| accepted

Answered
Problem with Less than or Equal to Operator <=
_"Problem with Less than or Equal to Operator"_ Nope, there is no problem with the <https://www.mathworks.com/help/matlab/ref...

8 years ago | 1

| accepted

Load more