Storing string of a loop
Your code has multiple bugs, in particular wrong indexing into the cell array, missing format specifier in the |sprintf| format ...

15 days ago | 1

| accepted

Sorting 256*2 cell
Although the question is not very clear, I suspect that you might like to download and try my FEX submission natsortrows, which ...

15 days ago | 0

| accepted

Combination of 2 columns
[Am,Bm] = ndgrid(A,B); M = [Am(:),Bm(:)]

15 days ago | 0

| accepted

Write a program that calculates the length of hypotenuse c for all (!) combinations of legs a and b and do so using a for loop!
The easiest way to get all combinations is to use two loops: a = [3;5;1;3;2]; b = [1;3;2;7;2]; for ii = 1:numel(a) for j...

15 days ago | 0

How can I get the full value of a variable with decimal point
"the actual answer is 0.0205 But my result is displayed as 0 For 0.5 it is displayed as 1" Those are the values, they are NOT j...

15 days ago | 2

| accepted

Image Saving to Variable in Workspace (NOT imwrite)
"In this case sp_possible_quadtree is a double. where the contents are either 0 for Black, or an integer 1, 2, 3, 4, ... n" LLL...

15 days ago | 0

Extracting string and number pairs from a mixed string
The two lines marked with %%% are used to convert substrings like '(Fe0.5Co0.5)58.5' into 'Fe29.25Co29.25', after which the desi...

15 days ago | 1

| accepted

How can I convert a number to time?
>> V = randi(58232,7,1) % fake data V = 7565 33124 27334 694 19632 9445 ...

16 days ago | 0

| accepted

how to Vectorize this for loop
Try doing something like this: [fid,msg] = fopen('CANDec(day_1_9).txt','rt'); assert(fid>=3,msg) % good practice to check the ...

16 days ago | 0

| accepted

Submitted

Interactive Regular Expression Tool
Develop and refine regular expressions in an interactive figure that shows all REGEXP's outputs.

scalar vs matrix vs vector vs array??
Just like in mathematics, the only difference is their size. MATLAB does not have special classes for scalars, vectors, matrice...

16 days ago | 2

| accepted

Reducing repeated elements in an array by a factor
>> V = [1,2,2,2,2,2,2,5,6]; >> N = 3; >> X = cumsum([1,diff(V)~=0]); >> F = @(v) {v(1:ceil(numel(v)/N))}; >> cell2mat(accuma...

16 days ago | 2

| accepted

Storing Function Handles in structure
>> fun = @(x,y,z) [x,y,z]; >> baz = @(n,v) v(n); % helper function >> a = @(n) @(x,y,z)baz(n,fun(x,y,z)); Testing: >> f = a(...

17 days ago | 1

| accepted

creating channels in an array
"What does this error mean?" You are trying to access array elements that do not exist! You defined h to have size 4x5(x1x1x1....

17 days ago | 0

| accepted

Problem using for loop
a = 1:10; n = numel(a); for kk = 1:n for ii = max(1,kk-2):min(n,kk+2) x = a(ii); end end

17 days ago | 0

| accepted

how to use interp1() function
The problem is that you are using the default x values, which for a vector input are defined as 1:numel(v) These default point...

17 days ago | 0

| accepted

Error using textscan Mismatch between file and format character vector. Trouble reading 'Numeric' field from file (row number 1, field number 3)
The second field is clearly not numeric, containing values like 020520t1xy10z12.tif 020520t1xy10z12.tif 020520t1xy10z12.tif ...

17 days ago | 1

Insert zero columns in matrices inside a cell array
Where C is your cell array: for k = 1:numel(C) C{k}(:,end+1:30) = 0; end

17 days ago | 0

| accepted

Delete values in one matrix that aren't contained in a second matrix
>> M1 = dlmread('coordiates_variable.dat'); >> M2 = dlmread('coordinates.txt'); >> idx = ismembertol(M1(:,1:3),M2, 0.0001, 'By...

17 days ago | 0

How to convert a 8760X30matrix to a 365X30 matrix?
>> inp = rand(8760,30); % fake data matrix >> out = mean(permute(reshape(inp,24,[],30),[2,3,1]),3); And checking: >> size(out...

17 days ago | 0

| accepted

for-loop over Structure Array
"Can anybody exlpain to me, why this happens" Because MATLAB is (as far the end-user is concerned) pass-by-value and not pass-b...

18 days ago | 0

| accepted

Dynamic on the fly expression/function
Vector Indices: You can do this quite easily by generating vectors of indices and taking advantage of the fact that addition and...

18 days ago | 1

| accepted

how to call a variable inside a function
No need for a loop: nAZ = histc(char(lower(stateNames)).','a':'z').'; E.g.: >> nAZ = histc(char(lower(stateNames)).','a':'z')...

19 days ago | 0

Text file i/o problem....I always get 0 with charnum ...whats the problem with the code??
Your code has likely has several bugs, e.g. you were checking for literal "character" as opposed to using the contents of the ch...

19 days ago | 0

| accepted

how to do a loop and call a function
As described in the question, you will have to do something like this: L = ???; D = ???; P = ???; r = ???; c = ???; a = ??...

19 days ago | 0

Undefined function 'de' for input arguments of type 'double'.
"... the vector "de" is well defined in mdlderivatives of my s-function." And that is part of the problem: mdlderivatives has a...

19 days ago | 0

| accepted

How can I save the differents values of a variable which is into a for loop?
Just use indexing, e.g.: Ckk = cell(1,nel); for iel = 1:nel ... your code Ckk{iel} = ... variable you want to stor...

19 days ago | 0

error during selecting dynamically image from folder
"I want to randomaly select 8 images from specific folder how i can do that" Something like this: P = 'path to the folder wher...

20 days ago | 0

| accepted

How to compare the saved names of two images stored in different folders ?
I don't think imageDatastore particularly helps in this case. Something like this: P1 = 'G:\MTech\InputImages'; P2 = 'G:\MTech...

20 days ago | 1

| accepted