Answered
Understanding Figure Windows & Changing Their Apperances
"Why cannot i amend the Number property?" Because the 'Number' property is read only: https://www.mathworks.com/help/matlab/re...

7 years ago | 0

| accepted

Answered
How do I change the values of rows in specific columns based on another table which serves as a lookup?
>> A = [2001,2001;2001,2003;2001,2005;2001,2006] A = 2001 2001 2001 2003 2001 2005 2001 2006 >> B = [1...

7 years ago | 0

| accepted

Answered
How do I locate all integer values within a matrix (of string and integer values in the same cell), then replace all those integer values with a 1 or 0 thus forming a new matrix with the replaced integers?
Method one: multiple regular expressions in one regexprep call: >> c = {'( x(2) | x(1) )', 'x(3)', '( x(4) | x(6) | x(5) )', '(...

7 years ago | 1

Answered
Dont know how to name this...
MATLAB only accepts decimal point , and does NOT accept a decimal comma. When you write a comma you are writing two separate va...

7 years ago | 1

| accepted

Answered
Please help me to understand Error "The expression to the left of the equals sign is not a valid target for an assignment.
The problem is your invented syntax using { and }, which looks like you are trying to write code using a different programming l...

7 years ago | 2

| accepted

Answered
How to read specific parts of file and then write it to a text file?
This imports all of the "TEC MAP" data from the file you uploaded: str = fileread('codg1520.14i'); % Functions to convert text...

7 years ago | 0

| accepted

Answered
Minimum value of loop
>> N = 3; >> a = Inf; >> for k = 1:N, a = min(a,k+2); end >> a a = 3

7 years ago | 0

| accepted

Answered
How to concatenate all these cells vertically?
>> load('matlab.mat') >> R = S.result; >> T = vertcat(R{:}); >> whos T Name Size Bytes Class Attr...

7 years ago | 1

| accepted

Answered
Creating a tridiagonal matrix
"My teacher has said that the best way to go about it is using loops" Why on earth would they say that? Here are some non-loop ...

7 years ago | 11

| accepted

Answered
split a string by a set of pre-defined number of characters rather than any delimiter
You could do that using regular expressions: >> S1 = ' 961.666 - Psat 1.0000 45.0971 3.6734';...

7 years ago | 0

| accepted

Answered
removing non prime number function
str = fileread('temp.txt'); vec = str2double(regexp(str,'\d+','match')) [fid,msg] = fopen('output.txt','wt'); assert(fid>=3,m...

7 years ago | 0

Answered
Repeat the value of a variable to match the length of another variable
>> X = 'TESTING'; >> Y = 'WORLD'; >> Z = Y(1+mod(0:numel(X)-1,numel(Y))) Z = WORLDWO

7 years ago | 0

Answered
Substract Matrix coloum-wise from Matrix without using a loop
permute lets you do this on one line: D = min(sqrt(sum(bsxfun(@minus,permute(A,[1,3,2]),permute(B,[3,1,2])).^2,3)),[],1); And ...

7 years ago | 0

| accepted

Answered
Is MATLAB confusing functions and arrays?
"Is MATLAB confusing functions and arrays?" That can happen in certain circumstances, but that does not seem to be the case her...

7 years ago | 1

| accepted

Answered
Storing user inputs during while loop, in a vector
x = []; while ... x(end+1) = input(prompt); end

7 years ago | 0

Answered
find elements vector in a matrix
Simply use sub2ind like this: >> idx = sub2ind(size(psic_pos),1:size(psic_pos,1),loc); >> vec = psic_pos(idx) vec = 0....

7 years ago | 1

| accepted

Answered
find 4d matrix positions
"I tried with ind2sub but it was useless." It worked for me. First lets define some fake data: >> A = zeros(5,4,3,2); >> A(5,...

7 years ago | 0

| accepted

Answered
import data without header
opt = {'HeaderLines',20}; fmt = repmat('%f',1,4); str = fileread('temp0.txt'); C = textscan(strrep(str,',','.'),fmt,opt{:}); ...

7 years ago | 0

| accepted

Answered
Extract number from file name
>> C = {'K10_0.0.json', 'Mig_Thresh_2.0.json', 'K_5_6.5.json', 'WC_0.00051.json'}; >> [~,N] = cellfun(@fileparts,C,'uni',0); >...

7 years ago | 1

Answered
Switch function to output number of days in a month
Actually you need to use the optional 's' argument for input, otherwise your code will throw an error: n = input('Enter the mon...

7 years ago | 0

| accepted

Answered
How to solve Reference to non-existent field 'folder'.
The folder field (and recursive folder searching) was added in R2016b. As you are not using the recursive folder search you can...

7 years ago | 0

| accepted

Answered
Sort the dir loaded files
Download my FEX submission natsortfiles and follow the examples in its documentation: https://www.mathworks.com/matlabcentral/f...

7 years ago | 0

Answered
Changing the ASCII sort order format?
To sort filenames into the order that you want download my FEX submission natsortfiles: https://www.mathworks.com/matlabcentral...

7 years ago | 0

Answered
Duplicate Each Element in a Matrix without using Repelem or Repmat
>> A = [1,0;0,1] A = 1 0 0 1 >> V = ceil((1:6)/3); >> B = A(V,V) B = 1 1 1 0 0 0 1 1 1 0...

7 years ago | 3

Answered
Can anyone help? I cannot figure out how to use a for loop to check elements in part of a matrix.
"I can make the actual matrix, but after that I don't know what comes next." Your assignment tells you exactly what you need to...

7 years ago | 0

| accepted

Answered
Indexing into a type I don't recognize
Use indexing to get any elements you want from a structure array: ext_header(ii).value https://www.mathworks.com/help/matlab/m...

7 years ago | 0

| accepted

Answered
Dimensions of arrays being concatenated are not consistent
You included definitions for every variable except for the one that likely causes the problem, I0. Running your code gives an e...

7 years ago | 0

| accepted

Answered
Is there a command ( like "sort" for example ) arranges vector elements ascending ,max, descending (humped shap)?
>> V = randi(99,1,23) V = 93 68 76 74 39 65 17 70 4 28 5 10 82 69 32 95 ...

7 years ago | 0

| accepted

Answered
Delimiter problems with =
opt = {'Delimiter','='}; fmt = '%s%[^\n]'; [fid,msg] = fopen('ENTRADA.txt','rt'); assert(fid>=3,msg) C = textscan(fid,fmt,op...

7 years ago | 1

| accepted

Answered
Cant get my code to work
Note the spelling difference: Guass_t % function output arugment Gauss_t % variable defined in the function

7 years ago | 0

| accepted

Load more